I wanted a dependency tree for the parsing result. I did the parsing using the code given on the github repo of stanford core nlp
I got the result as follows.[jupyter notebook result screenshot][1]
I have seen other answers mentioning graphviz and todoformat() but these methods require semanticgraph format input(todoformat does as far as i know). I have been able to convert the result of parsing to the following format but it is a list of strings. [the new format of result][2] As I saw other result formats like this. What can I do to get the dependency tree graph? Is the result that I am getting be changed in a form that works for todoformat? I am new to this. I would really appreciate your help. [1]: https://i.stack.imgur.com/qma9n.png [2]: https://i.stack.imgur.com/Xjhwh.png
Code:
with CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','parse','depparse','coref'], timeout=60000, memory='16G') as client:
# submit the request to the server
ann = client.annotate(text)
sentence = ann.sentence[0]
print('dependency parse of first sentence')
dependency_parse = sentence.basicDependencies
print(dependency_parse)````