Python NLP
About Lesson

In this Python NLP lesson we are going to learn about Python NLP POS Tagging, for POS Tagging we can say Parts of Speech Tagging.

 

 

What is Parts of Speech ?

Parts-of-speech (POS) is one of the many tasks in NLP, you may have heard about Part of Speech (POS). so In English the main parts of speech are noun, pronoun, adjective, determiner, verb, adverb, preposition, conjunction, and interjection. Before this you will be familiar that what are adjectives or what are adverbs and what are difference between these. Now as a human you will know about this, but let’s think about the system where we can encode all this knowledge. The parts-of-speech tag identifies whether a word is a noun, verb, adjective, and so on. There are numerous applications of parts-of-speech tagging, such as information retrieval, machine translation and so on.

 

 

What is Parts of Speech Tagging (POS) ?

Parts-of-speech tagging is the process of assigning a category (for example, noun, verb, adjective, and so on) tag to individual tokens in a sentence. In NLTK, taggers are present in the nltk.tag package and it is inherited by the TaggerIbase class.

 

 

OK now let’s create a simple example in POS Tagging.

 

 

 

If you run the code you will see this result.

 

 

If you don’t know for example what is NN or what is VBZ, there is a function in NLTK that you can use.

 

 

 

This will be the result 

 

 

 

Let’s create another example, this time we want to use Wikipedia library, we want to extract some data from Wikipedia, first of all you need to install this library using pip.

 

 

This is our example

 

 

 

Run the code and this will be the result.

 

 

 

Now we are going to separate NN and NNP from our text, you can use this code for that.