0% found this document useful (0 votes)
67 views6 pages

Practical Lect1 - NLP in Python by TextBlob

This document discusses using the TextBlob library in Python for natural language processing (NLP) tasks. It outlines how to install TextBlob and use it for tokenization, part-of-speech tagging, word inflection, n-grams, spelling correction, language detection, and translation. TextBlob is recommended for beginners to NLP as it is easy to learn and offers many features, while more advanced options like spaCy are also mentioned.

Uploaded by

Dhamyaa Nasrawi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views6 pages

Practical Lect1 - NLP in Python by TextBlob

This document discusses using the TextBlob library in Python for natural language processing (NLP) tasks. It outlines how to install TextBlob and use it for tokenization, part-of-speech tagging, word inflection, n-grams, spelling correction, language detection, and translation. TextBlob is recommended for beginners to NLP as it is easy to learn and offers many features, while more advanced options like spaCy are also mentioned.

Uploaded by

Dhamyaa Nasrawi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NLP in Python by TextBlob Practical Machine Learning2

Date: 11 May. 2021 3rd Stage


……………………………………………………..………………………………………………………………

Natural Language Processing (NLP) is an area of growing attention


due to increasing number of applications like chatbots, machine
translation etc. In some ways, the entire revolution of intelligent
machines in based on the ability to understand and interact with
humans.

Outline

 Why TextBlob?
 Installing package
 Tokenization
 POS-Tagging
 Words inflection
 N-grams
 Spelling correction
 Language detection and Translation

1
NLP in Python by TextBlob Practical Machine Learning2
Date: 11 May. 2021 3rd Stage
……………………………………………………..………………………………………………………………

 Why TextBlob?
There are many libraries to explore NLP:

1- NLTK is a perfect library for education and research, it


becomes very heavy and tedious for completing even the
simple tasks.

2- TextBlob it is easy to learn and offers a lot of features like


sentiment analysis, pos-tagging, noun phrase extraction, etc.

3- spacy it is recognized as one of the powerful and advanced


library used to implement NLP tasks.

If it is your first step in NLP, TextBlob is the perfect library for you to
get hands-on with.

 Installing Packages
Installation of TextBlob in your system in a simple task, all you need
to do is open cmd prompt and enter the following commands:

pip install textblob

 Tokenization
Tokenization refers to dividing text or a sentence into a
sequence of tokens, which roughly correspond to “words”.
This is one of the basic tasks of NLP. To do this using
TextBlob, follow the two steps:

1. Create a textblob object and pass a string with it.


2. Call functions of textblob in order to do a specific task.

2
NLP in Python by TextBlob Practical Machine Learning2
Date: 11 May. 2021 3rd Stage
……………………………………………………..………………………………………………………………

This textblob can be tokenized into a sentence and further into


words. In the following read from text file

3
NLP in Python by TextBlob Practical Machine Learning2
Date: 11 May. 2021 3rd Stage
……………………………………………………..………………………………………………………………

 POS-Tagging
Part-of-speech tagging or grammatical tagging is a method
to mark words present in a text on the basis of its definition
and context. In simple words, it tells whether a word is a
noun, or an adjective, or a verb, etc.

Here’s a list of the tags, what they mean, and some


examples:

4
NLP in Python by TextBlob Practical Machine Learning2
Date: 11 May. 2021 3rd Stage
……………………………………………………..………………………………………………………………

 Word inflection

 N-grams
A combination of multiple words together

5
NLP in Python by TextBlob Practical Machine Learning2
Date: 11 May. 2021 3rd Stage
……………………………………………………..………………………………………………………………

 Spelling correction

 Language detection and Translation

You might also like