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?