Python NLP – Parts of Speech Default Tagging

In this Python NLP article we are going to learn about Parts of Speech Default Tagging, 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.

 

 

Learn about Parts of Speech Tagging (POS) in NLTK

 

 

 

 

So 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 DefaultTagger 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.

 

 

 

 

So in here 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.

 

 

 

 

Now let’s just talk about BackOffTagging , so back of tagging is one of the features  from

SequentialBackOffTagger. using Back of tagging we can chain taggers together, so if that one

tagger  does not know how to tag a word, it pass the word to the next back off tagger, if that one was

not able to tag the word it can pass that to another Back Of Tagger, so this is the work for BackOff

Tagging.

 

 

 

 

 

After runing you can see that we have good accuracy and it is 85 percent.

 

 

 

Along with UnigramTagger, there are two more taggers that we can use, we have BigramTagger

and TriGramTagger.

 

 

 

 

 

 

 

Subscribe and Get Free Video Courses & Articles in your Email

 

1 thought on “Python NLP – Parts of Speech Default Tagging”

  1. YOU NEED QUALITY VISITORS for your: codeloop.org

    My name is Rodrigo Blanchette, and I’m a Web Traffic Specialist. I can get:
    – visitors from search engines
    – visitors from social media
    – visitors from any country you want
    – very low bounce rate & long visit duration

    CLAIM YOUR 24 HOURS FREE TEST => https://bit.ly/3h750yC

Comments are closed.

Share via
Copy link
Powered by Social Snap
×