python下结巴中文分词

http://blog.csdn.net/pipisorry/article/details/45311229

jieba中文分词的使用

import jieba
sentences = ["我喜欢吃土豆","土豆是个百搭的东西","我不喜欢今天雾霾的北京", 'costumer service']
# jieba.suggest_freq('雾霾', True)
# jieba.suggest_freq('百搭', True)
words = [list(jieba.cut(doc)) for doc in sentences]
print(words)

[['我', '喜欢', '吃', '土豆'],
 ['土豆', '是', '个', '百搭', '的', '东西'],
 ['我', '不', '喜欢', '今天', '雾霾', '的', '北京'],
 ['costumer', ' ', 'service']]
[ https://github.com/fxsjy/jieba]

from:http://blog.csdn.net/pipisorry/article/details/45311229


你可能感兴趣的:(python,中文分词,结巴,jieba)