I am exploring the spacy nlp python library. I have got this:
text='Daniel is a smart clever professor.'
spacy_doc = nlp(text)
token_pos=[token.pos_ for token in spacy_doc]
token_tag=[token.tag_ for token in spacy_doc]
token_dep=[token.dep_ for token in spacy_doc]
token_pos
Out[105]: ['PROPN', 'VERB', 'DET', 'ADJ', 'ADJ', 'NOUN', 'PUNCT']
token_tag
Out[106]: ['NNP', 'VBZ', 'DT', 'JJ', 'JJ', 'NN', '.']
token_dep
Out[107]: ['nsubj', 'ROOT', 'det', 'amod', 'amod', 'attr', 'punct']
spacy.explain('attr')
Out[108]: 'attribute'
def to_nltk_tree(node):
if node.n_lefts + node.n_rights > 0:
return Tree(node.orth_, [to_nltk_tree(child) for child in node.children])
else:
return node.orth_
[to_nltk_tree(sent.root).pretty_print() for sent in spacy_doc.sents]
is
_________|______
| | professor
| | ______|_______
Daniel . a smart clever
Spacy explains that "professor" is an attribute ('attr') of "is".
What is exactly an attribute?
Where can I find this kind of information?
Are there other examples of 'attr' in different grammatical contexts?
Attribute is a label of dependency relation that seems to be obsolete now. See page 23 of this manual: https://nlp.stanford.edu/software/dependencies_manual.pdf
This dependency relation seems to be used to link the copula verb with its NP argument in attributive constructs, for example Daniel is -> professor, she is -> smart. Consult page 27 of http://www.mathcs.emory.edu/~choi/doc/cu-2012-choi.pdf
Interestingly, the current annotation guidelines for Universal Dependencies have attributive constructs annotated quite differently: there is a cop label involved and, surprisingly, the attributive NP/AdjP is linked directly to its “subject”.
https://universaldependencies.org/v2/copula.html
So, these labels are likely to be changed in the future I believe.