def _to_nltk_format(self):
from nltk import Tree
return Tree(self.parent_relation,
[Tree(self.pos,
[self.word] + [c._to_nltk_format() for c in self.children] )])
# from nltk import Tree
# label = "({0}) {1} ({2})".format(self.parent_relation,self.word,self.pos)
# if not self.children:
# return label
# return Tree(label,[c._to_nltk_format() for c in self.children])
# Feature functions, should conform to naming _(PREDICATE/ARGUMENT)_FEATURE_(feature_name)
# and return a tuple of (value,span)
#return the head of the
评论列表
文章目录