model.py 文件源码

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

项目:MorphForest 作者: j-luo93 项目源码 文件源码
def get_seg_path(self, word):
        path = Path(word)
        while not path.is_ended():
            child = path.get_fringe_word()
            parts = child.split("'")
            if len(parts) == 2 and len(parts[0]) > 0 and self.lang == 'eng':
                path.expand(child, parts[0], 'APOSTR')
            else:
                parts = child.split('-')
                if len(parts) > 1:
                    p1, p2 = parts[0], child[len(parts[0]) + 1:]
                    path.expand(child, (p1, p2), 'HYPHEN')
                else:
                    parent, type_ = self.predict(child)
                    path.expand(child, parent, type_)
        return path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号