POS statistics

Report a typo

Find the most frequent tag in a given sentence. Output the right tag name. If there are two or more tags with a similar frequency, output the first one.

Don't forget to tokenize the input sentence.

NLTK tagsets usually contain tuples. You can unpack a tuple with for (word, pos) in tagged

You may create a list of all POS tags in a sentence and then go through each of them. A for loop can help you.

You can count POS tags in the following way: ['NN', 'VBZ', 'ADJ', 'NN'].count('NN'). The output will be: 2. Another way to count the POS tags is to create a list of words of a specific POS and then count it with len().

Sample Input 1:

The Tiber island is the only river island in the part of the Tiber which runs through Rome

Sample Output 1:

DT
Write a program in Python 3
# put your python code here
___

Create a free account to access the full topic