Python 模式库:哪个单词是句子的根(依赖项解析)?

Python 模式库:哪个单词是句子的根(依赖项解析)?,python,design-patterns,nlp,dependency-parsing,Python,Design Patterns,Nlp,Dependency Parsing,在spacy中,依赖项的开始从根开始 在模式中。en同一个动词被标记为VP。如果有多个VP,您如何知道哪一个是根? 它总是标有“-1”的那个吗 那么多个OBJ和SUBJ呢 : pattern.en.parse('John hit the ball', relations=True) : u'John/NNP/B-NP/O/NP-SBJ-1 hit/VBD/B-VP/O/VP-1 the/DT/B-NP/O/NP-OBJ-1 ball/NN/I-NP/O/NP-OBJ-1' : doc

在spacy中,依赖项的开始从根开始

模式中。en同一个动词被标记为VP。如果有多个VP,您如何知道哪一个是根? 它总是标有“-1”的那个吗

那么多个OBJ和SUBJ呢

 : pattern.en.parse('John hit the ball', relations=True)
 : u'John/NNP/B-NP/O/NP-SBJ-1 hit/VBD/B-VP/O/VP-1 the/DT/B-NP/O/NP-OBJ-1 ball/NN/I-NP/O/NP-OBJ-1'


 : doc = nlp(u'John hit the ball')
 : [ (t.text, t.dep_) for t in doc ]
 : [(u'John', u'nsubj'), (u'hit', u'ROOT'), (u'the', u'det'), (u'ball', u'dobj')]