October 2018
Intermediate to advanced
472 pages
10h 57m
English
Let's extract all of the verbs present in the corpus. In this case, we are using VB, VBD, VBG, VBN, VBP, and VBZ as verb tags:
verbs = [] for tag in tagged_wt:verbs.append([k for k,v in tag if v in ['VB','VBD','VBG','VBN','VBP','VBZ']])[['extract', 'meaning', 'is', 'analyze'], ['breaking', 'is', 'called', 'are', 'referred'], ['are'], ['has', 'use'], ['is', 'are', 'are', 'are'], ['Using', "'s", 'create', 'counting']]
Now, let's use spacy to tokenize a piece of text and access the POS attribute for each token. As an example application, we'll tokenize the previous paragraph and count the most common nouns with the following code. We'll also lemmatize the tokens, which gives the root form a word, to help us standardize across ...
Read now
Unlock full access