python词频统计实例

# 词频统计
import jieba  # 分词库包
import snownlp  # 情感分析

words = '非常时尚鞋子,非常非常非常时尚的一款鞋子,设计好看,设计设计做活动买的,超超超超超超超超超划算。满意。设计好看!'
words_list = list(jieba.cut(words))

words_frequency = {
     }
for wl in words_list:
    if wl in words_frequency.keys():
        words_frequency[wl] += 1
    else:
        words_frequency[wl] = 1

a=words_frequency.items()
words_sort = sorted(words_frequency.items(),key=lambda x:x[1],reverse=True)
print(words_sort)

你可能感兴趣的:(python,jieba,词频统计,python,大数据)