Just for fun, we've developed a game to test your knowledge of Part of Speech tags. The object of the game is to write a body of text that contains as many different fine-grained tags as possible. The highest possible score is 100 (or thereabouts). Points are awarded for the number of unique tags used, and for the fewest possible tokens used. Below is an example. Feel free to post your results in the Q&A Forum for this lecture, and good luck!
In [4]:
# Perform standard imports
import spacy
nlp = spacy.load('en_core_web_sm')
# Import the game script
import game
In [5]:
# Enter your text here:
text = u"The quick brown fox jumped over the lazy dog's back."
In [6]:
# Make your Doc object and pass it into the scorer:
doc = nlp(text)
print(game.scorer(doc))
In [7]:
# For practice, visualize your fine-grained POS tags (shown in the third column):
print(f"{'TOKEN':{10}} {'COARSE':{8}} {'FINE':{6}} {'DESCRIPTION'}")
print(f"{'-----':{10}} {'------':{8}} {'----':{6}} {'-----------'}")
for token in doc:
print(f'{token.text:{10}} {token.pos_:{8}} {token.tag_:{6}} {spacy.explain(token.tag_)}')
Coarse POS Tag | Description | Fine-grained Tag | Description | Morphology | |
---|---|---|---|---|---|
1. | ADJ | adjective | AFX | affix | Hyph=yes |
2. | ADJ | JJ | adjective | Degree=pos | |
3. | ADJ | JJR | adjective, comparative | Degree=comp | |
4. | ADJ | JJS | adjective, superlative | Degree=sup | |
5. | ADJ | PDT | predeterminer | AdjType=pdt PronType=prn | |
6. | ADJ | PRP\$ | pronoun, possessive | PronType=prs Poss=yes | |
7. | ADJ | WDT | wh-determiner | PronType=int rel | |
8. | ADJ | WP\$ | wh-pronoun, possessive | Poss=yes PronType=int rel | |
9. | ADP | adposition | IN | conjunction, subordinating or preposition | |
10. | ADV | adverb | EX | existential there | AdvType=ex |
11. | ADV | RB | adverb | Degree=pos | |
12. | ADV | RBR | adverb, comparative | Degree=comp | |
13. | ADV | RBS | adverb, superlative | Degree=sup | |
14. | ADV | WRB | wh-adverb | PronType=int rel | |
15. | CONJ | conjunction | CC | conjunction, coordinating | ConjType=coor |
16. | DET | determiner | DT | determiner | |
17. | INTJ | interjection | UH | interjection | |
18. | NOUN | noun | NN | noun, singular or mass | Number=sing |
19. | NOUN | NNS | noun, plural | Number=plur | |
20. | NOUN | WP | wh-pronoun, personal | PronType=int rel | |
21. | NUM | numeral | CD | cardinal number | NumType=card |
22. | PART | particle | POS | possessive ending | Poss=yes |
23. | PART | RP | adverb, particle | ||
24. | PART | TO | infinitival to | PartType=inf VerbForm=inf | |
25. | PRON | pronoun | PRP | pronoun, personal | PronType=prs |
26. | PROPN | proper noun | NNP | noun, proper singular | NounType=prop Number=sign |
27. | PROPN | NNPS | noun, proper plural | NounType=prop Number=plur | |
28. | PUNCT | punctuation | -LRB- | left round bracket | PunctType=brck PunctSide=ini |
29. | PUNCT | -RRB- | right round bracket | PunctType=brck PunctSide=fin | |
30. | PUNCT | , | punctuation mark, comma | PunctType=comm | |
31. | PUNCT | : | punctuation mark, colon or ellipsis | ||
32. | PUNCT | . | punctuation mark, sentence closer | PunctType=peri | |
33. | PUNCT | '' | closing quotation mark | PunctType=quot PunctSide=fin | |
34. | PUNCT | "" | closing quotation mark | PunctType=quot PunctSide=fin | |
35. | PUNCT | `` | opening quotation mark | PunctType=quot PunctSide=ini | |
36. | PUNCT | HYPH | punctuation mark, hyphen | PunctType=dash | |
37. | PUNCT | LS | list item marker | NumType=ord | |
38. | PUNCT | NFP | superfluous punctuation | ||
39. | SYM | symbol | # | symbol, number sign | SymType=numbersign |
40. | SYM | \$ | symbol, currency | SymType=currency | |
41. | SYM | SYM | symbol | ||
42. | VERB | verb | BES | auxiliary "be" | |
43. | VERB | HVS | forms of "have" | ||
44. | VERB | MD | verb, modal auxiliary | VerbType=mod | |
45. | VERB | VB | verb, base form | VerbForm=inf | |
46. | VERB | VBD | verb, past tense | VerbForm=fin Tense=past | |
47. | VERB | VBG | verb, gerund or present participle | VerbForm=part Tense=pres Aspect=prog | |
48. | VERB | VBN | verb, past participle | VerbForm=part Tense=past Aspect=perf | |
49. | VERB | VBP | verb, non-3rd person singular present | VerbForm=fin Tense=pres | |
50. | VERB | VBZ | verb, 3rd person singular present | VerbForm=fin Tense=pres Number=sing Person=3 | |
51. | X | other | ADD | ||
52. | X | FW | foreign word | Foreign=yes | |
53. | X | GW | additional word in multi-word expression | ||
54. | X | XX | unknown | ||
55. | SPACE | space | _SP | space | |
56. | NIL | missing tag |