Tagger

Report a typo

Write a program that uses NLTK and labels all the words in the given sentence. Print the result.

For example, if the sentence looks like this:

sent = ['A', 'beautiful', 'lady', 'suddenly', 'appeared', 'in', 'front', 'of', 'him', '.']

Your program should print the following:

[('A', 'DT'), ('beautiful', 'JJ'), ('lady', 'NN'), ('suddenly', 'RB'), ('appeared', 'VBD'), ('in', 'IN'), ('front', 'NN'), ('of', 'IN'), ('him', 'PRP'), ('.', '.')]
Write a program in Python 3
import nltk


# the line below reads a sentence from the input and converts it into a list
sent = input().split()

# your code here
___

Create a free account to access the full topic