Python NLP
About Lesson

In this Python NLP lesson we are going to learn about Python NLP Default Tagger, so Default Tagging provides a baseline for part-of-speech tagging , it is performed using the DefaultTagger class. and It simply assigns the same part-of-speech tag to every token. The DefaultTagger class takes ‘tag’ as a single argument. for example NN is the tag for a singular noun.

 

 

 

In here for every tagger we have a tag method which takes token as list of arguments. if you run the code this will be the result.

 

 

Also you can untag a sentence using this code.

 

 

This is the result.

 

 

Also there is a function in Python NLP Default Tagger that you can predict the accuracy. so for this we are going to use Brown Corpus ,  The Brown Corpus was the first million-word electronic corpus  of English, created in 1961 at Brown University. This corpus  contains text from 500 sources, and the sources have been categorized by genre, such as news, editorial.

 

 

 

Run the code and you can see that we have received poorly result. the accuracy is 13 percent.

 

 

There are different taggers that you can use for example Unigram tagger, A Unigram generally refers to a single token. so a unigram tagger only uses a single  word as its context for determining the part-of-speech tag.

 

 

In the above example we have just used the 2000 tagged sentences from tree bank corpus as the training set to initialize the Unigram tagger class. if you run the code this is the result.

 

 

 

Now let’s check the accuracy.

 

 

If you see the accuracy, we are receiving 82 percent accuracy.

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found