部分常用分词工具使用整理( 六 )

segmentor.load('model/ltp_data_v3.4.0/cws.model') # 模型放置的路径

text = '化妆和服装'

words = segmentor.segment(text)

words = list(words)

print(words)

7、THULAC(清华中文词法分析工具包)

THULAC(THU Lexical Analyzer for Chinese)由清华大学自然语言处理与社会人文计算实验室研制推出的一套中文词法分析工具包 , 具有中文分词和词性标注功能 。

项目Github地址:THULAC-Python

安装:

pip install thulac

使用:

import thulac

thu = thulac.thulac(seg_only=True)

text = '化妆和服装'

推荐阅读