In [30]:
import jieba

In [31]:
seg_list = jieba.cut('我是一个山东人,我在北京工作,哈哈哈哈',cut_all=True) # 全模式

In [32]:
print('Full mode:' + '/'.join(seg_list))


Full mode:我/是/一个/山东/山东人///我/在/北京/工作///哈哈/哈哈哈/哈哈哈哈/哈哈/哈哈哈/哈哈

In [33]:
seg_right = jieba.cut('我是一个山东人,我在北京工作,哈哈哈哈',cut_all=False)

In [34]:
print('default mode:' + '/'.join(seg_right))


default mode:我/是/一个/山东人/,/我/在/北京/工作/,/哈哈哈哈

In [35]:
import jieba.analyse as analyse
lines = open('jieba.txt',encoding='utf-8').read()

In [36]:
print(' '.join(analyse.extract_tags(lines,topK=20,withWeight=True)))


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-36-13ae768d1b52> in <module>()
----> 1 print(' '.join(analyse.extract_tags(lines,topK=20,withWeight=True)))

TypeError: sequence item 0: expected str instance, tuple found