tree.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:props 作者: gabrielStanovsky 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号