Skip to content

customized_segmentor.load()加载模型不分词 #161

@Cugfu

Description

@Cugfu

操作系统是Linux,python3.5,pyltp0.2.1
代码是:
import os
from pyltp import CustomizedSegmentor,Segmentor
LTP_datadir = 'ltp_data'
cws_model_path = os.path.join(LTP_datadir, 'cws.model')
train_model_path = os.path.join(LTP_datadir, 'train.model')
customized_segmentor = CustomizedSegmentor()
customized_segmentor.load(cws_model_path, train_model_path)
words = customized_segmentor.segment('2014年是公司发展任务繁重、挑战突出的一年,也是攻坚克难、创新发展的一年')
print('\t'.join(words))
customized_segmentor.release()

使用otcws的customize-learn训练得到的train.model,在用customized_segmentor.loa加载模型之后结果完全不分词,但是使用learn训练得到的模型就可以正常分词,请问为什么呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions