I use Stanford coreNLP for generating dependency tree, but I cannot store the result as it uses print function to show the tree. For instance, the code and the dependency tree for "I ask a question in StackOverFlow" would be like this:
nlp = StanfordCoreNLP('.')
parser=nlp.parse("I ask a question in StackOverFlow")
tree=Tree.fromstring(parser.__str__())
tree.pretty_print()
Here I used Snipping Tool to take a screenshot of the generated tree manually, but in my code I will generate more than thousand trees, which is impossible to take screenshots from all of them. Any kind of help would be appreciated.