nlp: Что такое тег грамматической зависимости "attr"? - PullRequest
0 голосов
/ 14 июля 2020

Я изучаю просторную библиотеку nlp python. У меня есть это:

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

Спейси объясняет, что «профессор» является атрибутом ('attr') «is».

  1. Что такое атрибут ?

  2. Где я могу найти такую ​​информацию?

  3. Существуют ли другие примеры 'attr' в разных грамматических контекстах?

1 Ответ

2 голосов
/ 15 июля 2020

Атрибут - это метка отношения зависимости, которая сейчас кажется устаревшей. См. Страницу 23 данного руководства: https://nlp.stanford.edu/software/dependencies_manual.pdf

Stanford manual's take on ATTR

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

CLEAR-style manual's explanation of ATTR

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

Определение связки в UD 2.0

Думаю, в будущем эти метки, вероятно, будут изменены.

...