'sentences = data.split('。')for s in sentences: tokens = jieba.cut(s) prin'sentences = data.split('。')for s in sentences: tokens = jieba.cut(s) print([t for t in tokens if t not in punctuation and t.strip()]) print('-' * 80)#%%# 哪些词出现的概率高# 思路:使用 Counter 进行统计from collections import Countercounter = Counter()for s in sentences: tokens = jieba.cut(s) for t in tokens: if t not in punctuation and t.strip(): counter[t] = 1for w, v in counter.most_common(10): print(w, v)#%% [markdown]## ## 分词效果评估## 1. 是否保留了领域专有词# 2. 专有名词的识别# 3. 是否出现了生僻词# 4. 分词结果是否符合语义# 5. 语义和上下文是否有关联## ## 复合词的分词# 1. 技术# * B-Python, I-Python, B-Django, I-Django# 2. 学术# * B-华为, I-华为, B-挑战, I-挑战# 3. 品牌# * B-王老吉, I-王老吉, B-阿迪达斯, I-阿迪达斯data = 'Python的创始人是Guido van Rossum,1991年发明的Python语言是一种跨平台的计算机程序设计语言。'list(jieba.cut(data))#%%# 精确模式 jieba.cut详情