spaCy tags up each of the Token
s in a Document
with a part of speech (in two different formats, one stored in the pos
and pos_
At present, dependency parsing and tagging in SpaCy appears to be implemented only at the word level, and not at the phrase (other than noun phrase) or clause level. This means SpaCy can be used to identify things like nouns (NN, NNS), adjectives (JJ, JJR, JJS), and verbs (VB, VBD, VBG, etc.), but not adjective phrases (ADJP), adverbial phrases (ADVP), or questions (SBARQ, SQ).
For illustration, when you use SpaCy to parse the sentence "Which way is the bus going?", we get the following tree.
By contrast, if you use the Stanford parser you get a much more deeply structured syntax tree.
Just expand the lists at:
The docs have greatly improved since I first asked this question, and spaCy now documents this much better.
The pos
and tag
attributes are tabulated at https://spacy.io/api/annotation#pos-tagging, and the origin of those lists of values is described. At the time of this (January 2020) edit, the docs say of the pos
attribute that:
spaCy maps all language-specific part-of-speech tags to a small, fixed set of word type tags following the Universal Dependencies scheme. The universal tags don’t code for any morphological features and only cover the word type. They’re available as the Token.pos and Token.pos_ attributes.
As for the tag
attribute, the docs say:
The English part-of-speech tagger uses the OntoNotes 5 version of the Penn Treebank tag set. We also map the tags to the simpler Universal Dependencies v2 POS tag set.
and
The German part-of-speech tagger uses the TIGER Treebank annotation scheme. We also map the tags to the simpler Universal Dependencies v2 POS tag set.
You thus have a choice between using a coarse-grained tag set that is consistent across languages (.pos
), or a fine-grained tag set (.tag
) that is specific to a particular treebank, and hence a particular language.
.pos_
tag listThe docs list the following coarse-grained tags used for the pos
and pos_
attributes:
ADJ
: adjective, e.g. big, old, green, incomprehensible, firstADP
: adposition, e.g. in, to, duringADV
: adverb, e.g. very, tomorrow, down, where, thereAUX
: auxiliary, e.g. is, has (done), will (do), should (do)CONJ
: conjunction, e.g. and, or, butCCONJ
: coordinating conjunction, e.g. and, or, butDET
: determiner, e.g. a, an, theINTJ
: interjection, e.g. psst, ouch, bravo, helloNOUN
: noun, e.g. girl, cat, tree, air, beautyNUM
: numeral, e.g. 1, 2017, one, seventy-seven, IV, MMXIVPART
: particle, e.g. ’s, not,PRON
: pronoun, e.g I, you, he, she, myself, themselves, somebodyPROPN
: proper noun, e.g. Mary, John, London, NATO, HBOPUNCT
: punctuation, e.g. ., (, ), ?SCONJ
: subordinating conjunction, e.g. if, while, thatSYM
: symbol, e.g. $, %, §, ©, +, −, ×, ÷, =, :), The official documentation now provides much more details for all those annotations at https://spacy.io/api/annotation (and the list of other attributes for tokens can be found at https://spacy.io/api/token).
As the documentation shows, their parts-of-speech (POS) and dependency tags have both Universal and specific variations for different languages and the explain()
function is a very useful shortcut to get a better description of a tag's meaning without the documentation, e.g.
spacy.explain("VBD")
which gives "verb, past tense".
Just a quick tip about getting the detail meaning of the short forms. You can use explain
method like following:
spacy.explain('pobj')
which will give you output like:
'object of preposition'