关于测试翻译准确率的相关方法

本文提到的翻译准确率测试指标是BLEU,以及使用Python库-fuzzywuzzy来计算相似度

一、基于BLEU值评估
1.只评估一段话,代码如下

from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction

# 机器翻译结果
machine_translation = "How are you"
# 参考翻译列表
human_translations = ["How have you been lately?"]

# 使用SmoothingFunction.method1
chencherry = SmoothingFunction()

# 计算BLEU分数
bleu_score = sentence_bleu(human_translations, machine_translation, smoothing_function=chencherry.method1)

print(f"BLEU score: {
     
     bleu_score:.4f}")

评估结果如下,BLEU分数为0.17,换算为百分比后为17%
在这里插入图片描述

2.需要评估多段内容,将待评估的文字统一放入excel,代码如下

import pandas as pd
from nltk.translate.bleu_score import sentence_bleu

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值