由于项目需要,使用jieba分词库
点击项目,默认设置,选择项目翻译点击右侧 + ,


查询jieba ,点击左下角安装

还有一个放法(此方法未使用)
首先上githup下载jieba分词库
然后加压到任意目录
打开cmd命令行窗口并切换到jieba目录下
运行python setup.py install完成安装
在项目中使用import jieba使用jieba分词库
热刺索引
import jieba
txt=open("D:/hotword.txt","r",encoding="utf-8").read()
words =jieba.lcut(txt)
counts={}
for word in words:
if len(word)==1:
continue
else:
counts[word] = counts.get(word, 0) + 1
items =list(counts.items())
items.sort(key=lambda x:x[1],reverse=True)
for i in range(20):
word, count = items[i]
print(word, count)
# print('{0:<10}{1:>5}'.format(word,count))
检索资源来自飘的百度百科部分介绍:
