import nltk nltk.download('averaged_perceptron_tagger') nltk.download('punkt') from nltk.tokenize import word_tokenize from nltk import pos_tag sentence = "The quick brown fox jumps over the lazy dog." tokens = word_tokenize(sentence) tags = pos_tag(tokens) print(tags) # [('The', 'DT'), ('quick', 'JJ'), ('brown', 'JJ'), ('fox', 'NN'), # ('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'), ('dog', 'NN'), ('.', '.')]