【python ROUGE BLEU jiaba.cut NLP常用的指标计算】

pip install -U nltk rouge jieba

# Rouge

python 复制代码
from rouge import Rouge
rouge = Rouge()

reference = "The quick brown fox jumps over the lazy dog"
candidate = "The quick brown fox jumps over the dog"

scores = rouge.get_scores(candidate, reference)
scores

# jieba分词

python 复制代码
import jieba


text = "我爱自然语言处理"
seg_list = list(jieba.cut(text, cut_all=False))

print("分词结果:", seg_list)

# Bleu

python 复制代码
from nltk.translate.bleu_score import sentence_bleu

candidates = ["this", "is", "a", "test"]
references = [["this", "is", "a", "test"]]

bleu_score = sentence_bleu(references, candidates)
print(f"Corpus BLEU Score: {bleu_score}")
相关推荐
brent42321 分钟前
DAY50复习日
开发语言·python
万行38 分钟前
机器学习&第三章
人工智能·python·机器学习·数学建模·概率论
Data_agent41 分钟前
Cocbuy 模式淘宝 / 1688 代购系统(欧美市场)搭建指南
开发语言·python
m0_726365831 小时前
哈希分分预测系统 打造自适应趋势分析「Python+DeepSeek+PyQt5」
python·qt·哈希算法
vyuvyucd1 小时前
Qwen-1.8B-Chat昇腾Atlas800TA2部署实战
python
轻竹办公PPT1 小时前
2026 年工作计划 PPT 内容拆解,对比不同 AI 生成思路
人工智能·python·powerpoint
癫狂的兔子1 小时前
【Python】【Flask】抽奖功能
开发语言·python·flask
linuxxx1102 小时前
python变量引用的小案例
python
2501_936146042 小时前
烟草叶片病害检测_YOLO11-C3k2-MSBlock模型详解
python
Data_agent2 小时前
Python 编程实战:函数与模块化编程及内置模块探索
开发语言·python