Python NLP – Parts of Speech Tagging (POS)

In this Python NLP article we are going to talk about Parts of Speech Tagging (POS) in NLP, 

so first of all we are going to talk that what is Part of Speech and after that we talk about Part

of Speech Tagging (POS).

 

 

 

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.

 

 

 

Learn How to use Wordnet And Synset in NLTK with Python 

 

 

 

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.

 

 

 

So now let’s create an example

 

 

 

 

Run the code and this will be the result and you can see that we have done Parts of Speech Tagging

(POS) in our sentence, first we have tokenized the sentence to words and after that we have done 

Parts of Speech Tagging.

 

 

 

 

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

can use.

 

 

 

 

So now in this example we are going to know about NNS, you can see that it is Noun, Common

and Plural.

 

 

 

 

 

So in the second example we are going to use wikipedia library and we are going to extract data

from wikipedia, first of all you need to install wikipedia library, you can use pip for in the

installation, pip install wikipedia.

 

 

 

 

 

So now run the code and this will be the result.

 

 

 

 

Now we are going to separate NN and NNP from our text. 

 

 

 

 

If you run the code this will be the result.

 

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

Comments are closed.

Share via
Copy link
Powered by Social Snap
×