jieba库的安装

1.利用国内镜像网站下载:
首先打开cmd窗口输入如下命令:

pip install jieba -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

2.测试使用

import jieba
>>> jieba.lcut("中国是个伟大的国家")
Building prefix dict from the default dictionary ...
Dumping model to file cache C:\Users\17185\AppData\Local\Temp\jieba.cache
Loading model cost 0.920 seconds.
Prefix dict has been built successfully.
['中国', '是', '个', '伟大', '的', '国家']

3.jieba.add-word(“蟒蛇语言”),向词库中添加新词

你可能感兴趣的:(python)