October 2018
Intermediate to advanced
472 pages
10h 57m
English
Some words have multiple meanings, for example, charge is a noun, but can also be a verb, (to) charge. Knowing a Part-of-Speech (POS) can help to disambiguate the meaning. Each token in a sentence has several attributes that we can use for our analysis. The POS of a word is one example: nouns are a person, place, or thing; verbs are actions or occurrences and adjectives are words that describe nouns. Using these attributes, it becomes straightforward to create a summary of a piece of text by counting the most common nouns, verbs, and adjectives:
tagged_wt = [nltk.pos_tag(w)for w in words][[('One', 'CD'), ('way', 'NN'), ('to', 'TO'), ('extract', 'VB'), ('meaning', 'VBG'), ('from', 'IN'), ('text', 'NN'), ('is', 'VBZ'), ...Read now
Unlock full access