标签:import 分词 color python style python3 LTP info pytho
pyltp目前支持puthon3.6不支持3.7
用python3.7安装了很久都没有安装成功
无奈换成了3.6
from pyltp import SentenceSplitter sents = SentenceSplitter.split(‘元芳你怎么看?我就趴窗口上看呗!‘) # 分句 print(‘\n‘.join(sents))
切割句子。
分词
import os from pyltp import Segmentor LTP_DATA_DIR=‘D:\Python3.6\ltp3.4\ltp3.4‘ cws_model_path=os.path.join(LTP_DATA_DIR,‘cws.model‘) segmentor=Segmentor() segmentor.load(cws_model_path) words=segmentor.segment(‘熊高雄你吃饭了吗‘) print(type(words)) print(‘\t‘.join(words)) segmentor.release()
来源https://www.jianshu.com/p/f78453f5d1ca
标签:import 分词 color python style python3 LTP info pytho
原文地址:https://www.cnblogs.com/zlj843767688/p/12496486.html