Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
Cugfu opened this issue Jun 11, 2018 · 0 comments
Open

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

Cugfu opened this issue Jun 11, 2018 · 0 comments

Comments

@Cugfu
Copy link

Cugfu commented Jun 11, 2018

操作系统是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训练得到的模型就可以正常分词,请问为什么呢?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant