报错:
words = lcut(passage) #精确模式分词形式
NameError: name 'lcut' is not defined
words = lcut(passage)改为words = jieba.lcut(passage)也不行,继续报错如下图:
words = jieba.lcut(passage) #精确模式分词形式
AttributeError: module 'jieba' has no attribute 'lcut'
原因查找:
明明安装了jieba,也导入了
from jieba import *
改为
import jieba
也不行。
后来发现是文件命名成了jieba.py,冲突。
解决办法:
文件名修改一下,就可以了