This commit is contained in:
2025-09-06 08:38:04 +08:00
parent 9bf1128f4a
commit ada13af11e
9 changed files with 169 additions and 92 deletions

View File

@@ -6,6 +6,7 @@ import json
import ssl
import time
import xml.etree.ElementTree as ET
import base64
from datetime import datetime
from time import mktime
from urllib.parse import urlencode
@@ -163,10 +164,11 @@ class XunFeiAudioEvaluator:
# 查找read_chapter节点
read_chapter = root.find('.//read_chapter')
if read_chapter is not None:
# 保持字段名一致使用completeness_score
self.evaluation_results = {
'accuracy_score': float(read_chapter.get('accuracy_score', 0)),
'fluency_score': float(read_chapter.get('fluency_score', 0)),
'completeness_score': float(read_chapter.get('integrity_score', 0)), # 修复字段名
'completeness_score': float(read_chapter.get('integrity_score', 0)),
'standard_score': float(read_chapter.get('standard_score', 0)),
'total_score': float(read_chapter.get('total_score', 0)),
'word_count': int(read_chapter.get('word_count', 0)),
@@ -206,7 +208,8 @@ class XunFeiAudioEvaluator:
summary += f"总得分: {self.evaluation_results.get('total_score', 0):.4f}\n"
summary += f"准确度得分: {self.evaluation_results.get('accuracy_score', 0):.4f}\n"
summary += f"流畅度得分: {self.evaluation_results.get('fluency_score', 0):.4f}\n"
summary += f"完整度得分: {self.evaluation_results.get('integrity_score', 0):.4f}\n"
# 修复这里使用completeness_score
summary += f"完整度得分: {self.evaluation_results.get('completeness_score', 0):.4f}\n"
summary += f"标准度得分: {self.evaluation_results.get('standard_score', 0):.4f}\n"
summary += f"单词数量: {self.evaluation_results.get('word_count', 0)}\n"
summary += f"是否被拒绝: {'' if self.evaluation_results.get('is_rejected', False) else ''}\n"
@@ -269,8 +272,8 @@ if __name__ == '__main__':
appid = XF_APPID
api_secret = XF_APISECRET
api_key = XF_APIKEY
audio_file = "./1.mp3"
#audio_file = "./1.mp3"
audio_file=r'D:\dsWork\dsProject\dsLightRag\static\audio\audio_1f0a8c47db2d4f9ba7674055a352cab8.wav'
# 创建评测器实例
evaluator = XunFeiAudioEvaluator(appid, api_key, api_secret, audio_file, "english")