Machine learning 使用Stanford依赖项解析器进行依赖项解析

Machine learning 使用Stanford依赖项解析器进行依赖项解析,machine-learning,nlp,stanford-nlp,dependency-parsing,Machine Learning,Nlp,Stanford Nlp,Dependency Parsing,我试图提取一个句子中的主要动词,我遵循了这个,我期望以这种格式输出 nsubj(swim-4, Parrots-1) aux(swim-4, do-2) neg(swim-4, not-3) root(ROOT-0, swim-4) 但我是这样得到输出的 [<DependencyGraph with 94 nodes>] 我想我做错了什么,我怎样才能达到预期的输出是的,找到了如何通过,但它没有显示根属性,这是现在唯一的问题 dependencyParser = stanfor

我试图提取一个句子中的主要动词,我遵循了这个,我期望以这种格式输出

nsubj(swim-4, Parrots-1)
aux(swim-4, do-2)
neg(swim-4, not-3)
root(ROOT-0, swim-4)
但我是这样得到输出的

[<DependencyGraph with 94 nodes>]

我想我做错了什么,我怎样才能达到预期的输出是的,找到了如何通过,但它没有显示根属性,这是现在唯一的问题

  dependencyParser = stanford.StanfordDependencyParser(model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")
result = dependencyParser.raw_parse(noiseLessInput)
dep = result.__next__()
for triple in dep.triples():
 print(triple[1], "(", triple[0][0], ", ", triple[2][0], ")")
  dependencyParser = stanford.StanfordDependencyParser(model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")
result = dependencyParser.raw_parse(noiseLessInput)
dep = result.__next__()
for triple in dep.triples():
 print(triple[1], "(", triple[0][0], ", ", triple[2][0], ")")