Open amiref opened 6 years ago
maybe you can use nltk.corpus.BracketParseCorpusReader, nltk.tree ,this two library, to get what you want. just like this: `from nltk.tree import Tree
from stanfordcorenlp.corenlp import StanfordCoreNLP
nlp=StanfordCoreNLP(r'/home/.../Documents/postag/stanford-corenlp-full-2016-10-31/', lang='zh')
parser=nlp.parse('这样的言判也得到了证实,被害人的脑部有两处重击,脑浆外溢。')
print(parser)
tree=Tree.fromstring(parser.str())
print(tree.height())
nlp.close()`
class Tree has many other methods about the tree structure. hope that can help you.
Is there any way to find the depth of constituency tree?