我正在尝试在 Python 中使用 Spacy 构建和解释句子解析树的结果。我已经使用了以下代码:
from spacy.en import English
nlp=English()
example = "The angry bear chased the frightened little squirrel"
parsedEx = nlp(unicode(example))
for token in parsedEx:
print("Head:", token.head, " Left:",token.left_edge, " Right:",token.right_edge ," Relationship:",token.dep_)
代码给出了以下结果。有人可以告诉我如何解释吗?提前致谢!
('Head:', bear, ' Left:', The, ' Right:', The, ' Relationship:', u'det')
('Head:', bear, ' Left:', angry, ' Right:', angry, ' Relationship:', u'amod')
('Head:', chased, ' Left:', The, ' Right:', bear, ' Relationship:', u'nsubj')
('Head:', chased, ' Left:', The, ' Right:', squirrel, ' Relationship:', u'ROOT')
('Head:', squirrel, ' Left:', the, ' Right:', the, ' Relationship:', u'det')
('Head:', squirrel, ' Left:', frightened, ' Right:', frightened, ' Relationship:', u'amod')
('Head:', squirrel, ' Left:', little, ' Right:', little, ' Relationship:', u'amod')
('Head:', chased, ' Left:', the, ' Right:', squirrel, ' Relationship:', u'dobj')