'commit'
This commit is contained in:
@@ -105,21 +105,20 @@ class XunFeiAudioEvaluator_cn:
|
|||||||
"app_id": self.appid
|
"app_id": self.appid
|
||||||
},
|
},
|
||||||
"business": {
|
"business": {
|
||||||
"category": "read_sentence",
|
"category": "read_chapter",
|
||||||
"rstcd": "utf8",
|
"rstcd": "utf8",
|
||||||
"sub": "ise",
|
"sub": "ise",
|
||||||
"group": "pupil", # 根据文档设置为小学组
|
"group": "adult", # 根据文档设置为小学组
|
||||||
"ent": "cn_vip", # 固定中文引擎
|
"ent": "cn_vip", # 固定中文引擎
|
||||||
"tte": "utf-8",
|
"tte": "utf-8",
|
||||||
"cmd": "ssb",
|
"cmd": "ssb",
|
||||||
"auf": "audio/L16;rate=16000", # 修复参数格式错误
|
#"auf": "audio/L16;rate=16000", # 修复参数格式错误
|
||||||
"aue": "lame",
|
"aue": "lame",# mp3
|
||||||
"text": '\uFEFF' + "[content]\n" + self.txt, # 确保UTF8 BOM
|
"text": '\uFEFF' + "[content]\n" + self.txt, # 确保UTF8 BOM
|
||||||
"extra_ability": "multi_dimension" # 启用多维度评分
|
"extra_ability": "multi_dimension" # 启用多维度评分
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
"status": 0,
|
"status": 0,
|
||||||
"data": ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws.send(json.dumps(send_dict))
|
ws.send(json.dumps(send_dict))
|
||||||
@@ -169,21 +168,21 @@ class XunFeiAudioEvaluator_cn:
|
|||||||
"""解析中文评测XML结果(仅处理read_sentence节点)"""
|
"""解析中文评测XML结果(仅处理read_sentence节点)"""
|
||||||
try:
|
try:
|
||||||
root = ET.fromstring(xml_content)
|
root = ET.fromstring(xml_content)
|
||||||
# 中文专用:仅查找read_sentence节点
|
# 中文专用:查找read_chapter节点(原read_sentence)
|
||||||
read_sentence = root.find('.//read_sentence')
|
read_chapter = root.find('.//read_chapter')
|
||||||
if read_sentence is not None:
|
if read_chapter is not None:
|
||||||
# 中文评分字段映射
|
# 中文评分字段映射(修正节点名称和属性)
|
||||||
self.evaluation_results = {
|
self.evaluation_results = {
|
||||||
'total_score': float(read_sentence.get('total_score', 0)),
|
'total_score': float(read_chapter.get('total_score', 0)),
|
||||||
'accuracy_score': float(read_sentence.get('accuracy_score', 0)),
|
'accuracy_score': float(read_chapter.get('accuracy_score', 0)),
|
||||||
'fluency_score': float(read_sentence.get('fluency_score', 0)),
|
'fluency_score': float(read_chapter.get('fluency_score', 0)),
|
||||||
'integrity_score': float(read_sentence.get('integrity_score', 0)),
|
'integrity_score': float(read_chapter.get('integrity_score', 0)), # 修正字段名
|
||||||
'tone_score': float(read_sentence.get('tone_score', 0)), # 中文特有调型分
|
'tone_score': float(read_chapter.get('tone_score', 0)),
|
||||||
'is_rejected': read_sentence.get('is_rejected', 'false') == 'true'
|
'is_rejected': read_chapter.get('is_rejected', 'false') == 'true'
|
||||||
}
|
}
|
||||||
# 提取句子级得分(中文特有)
|
# 提取句子级得分
|
||||||
sentences = []
|
sentences = []
|
||||||
for sent in read_sentence.findall('.//sentence'):
|
for sent in read_chapter.findall('.//sentence'):
|
||||||
sentences.append({
|
sentences.append({
|
||||||
'content': sent.get('content', ''),
|
'content': sent.get('content', ''),
|
||||||
'total_score': float(sent.get('total_score', 0)),
|
'total_score': float(sent.get('total_score', 0)),
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user