i am trying to extract main verb in a sentence and i followed this question , i am expecting output in this format
nsubj(swim-4, Parrots-1)
aux(swim-4, do-2)
neg(swim-4, not-3)
root(ROOT-0, swim-4)
but i am getting output in this way
[<DependencyGraph with 94 nodes>]
i did following
dependencyParser = stanford.StanfordDependencyParser(model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz")
print (list(dependencyParser.raw_parse(noiseLessInput)))
i think i am doing something wrong, how can i achieve desired ouput
yeah, found how to do that through this question, but it is not showing root attribute, that's the only issue now
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], ")")