语音输入模式介绍

最近更新时间:2024-06-12 11:01:31

我的收藏

一次性评测

一次性评测,是一次性将音频数据上传进行评测。一般用于较短文件的评测。

请求参数

主要请求参数说明:
参数名称
类型
描述
WorkMode
Integer
语音输入模式。1:一次性评测
UserVoiceData
String
当前语音数据
SeqId
Integer
流式数据包的序号。1:初始化序号
IsEnd
Integer
是否传输完毕标志。1:传输完毕开始评估
请求示例
{
"WorkMode":1,
"UserVoiceData":"UklGRka1CQBXQVZFZ*****************************",
"SeqId":1,
"IsEnd":1,
"RefText":"hello",
"VoiceFileType":3,
"VoiceEncodeType":1,
"SessionId":"d0cecf7a-6bca-11ed-bdb0-acde48001122",
"EvalMode":0,
"ScoreCoeff":1.0
}

返回结果

正确返回结果
{
"Response":{
"SuggestedScore":9.398723,
"PronAccuracy":9.398723,
"PronFluency":0.8396871,
"PronCompletion":1,
"RequestId":"3b520d02-bc6a-4b3a-8396-fd4ecb0d63a8",
"Words":[
{
"MemBeginTime":1030,
"MemEndTime":2040,
"PronAccuracy":9.398723,
"PronFluency":0.8396871,
"ReferenceWord":"hello_0",
"Word":"hello",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1030,
"MemEndTime":1570,
"PronAccuracy":19.79675,
"DetectedStress":false,
"Phone":"hh",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1570,
"MemEndTime":1660,
"PronAccuracy":0.24008001,
"DetectedStress":false,
"Phone":"ah",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1660,
"MemEndTime":1810,
"PronAccuracy":0.015921298,
"DetectedStress":true,
"Phone":"l",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":true,
"MatchTag":0
},
{
"MemBeginTime":1810,
"MemEndTime":2040,
"PronAccuracy":17.542141,
"DetectedStress":false,
"Phone":"ow",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
}
],
"SessionId":"d0cecf7a-6bca-11ed-bdb0-acde48001122",
"AudioUrl":"",
"Status":"Finished"
}
}
错误返回结果
{
"Response":{
"RequestId":"8053e8ce-06d4-4100-9f10-4103cc53ab78",
"Error":{
"Code":"FailedOperation.ServiceTimeout",
"Message":"评测超时,请通过轮询查询评测结果,后续请使用分片传输或减少单次传输音频时长。"
}
}
}
如果返回评测超时可以通过轮询查询,或者使用流式评测进行分片传输。

轮询查询

请求参数

参数名称
类型
描述
IsQuery
Integer
查询标识。1:查询
SessionId
String
语音段唯一标识。
请求示例
评测超时后再次请求接口获取结果。此时只需要设置的 SessionId和IsQuery,其他必填参数需要满足类型,即可查询。SessionId 需要请求过评测接口才可以进行查询。
{
"IsQuery":1,
"SessionId":"d0cecf7a-6bca-11ed-bdb0-acde48001122",
"WorkMode":1,
"UserVoiceData":"",
"SeqId":1,
"IsEnd":1,
"RefText":"",
"VoiceFileType":3,
"VoiceEncodeType":1,
"EvalMode":0,
"ScoreCoeff":1.0
}

返回结果

主要返回参数
参数名称
类型
描述
Status
String
评估 session 状态。Finished:评估完成
返回示例
需要等到 Status 为 Finished,评估才完成。否则是还在评估中,可以重复发送请求来获取。
{
"Response":{
"SuggestedScore":9.398723,
"PronAccuracy":9.398723,
"PronFluency":0.8396871,
"PronCompletion":1,
"RequestId":"3b520d02-bc6a-4b3a-8396-fd4ecb0d63a8",
"Words":[
{
"MemBeginTime":1030,
"MemEndTime":2040,
"PronAccuracy":9.398723,
"PronFluency":0.8396871,
"ReferenceWord":"hello_0",
"Word":"hello",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1030,
"MemEndTime":1570,
"PronAccuracy":19.79675,
"DetectedStress":false,
"Phone":"hh",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1570,
"MemEndTime":1660,
"PronAccuracy":0.24008001,
"DetectedStress":false,
"Phone":"ah",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1660,
"MemEndTime":1810,
"PronAccuracy":0.015921298,
"DetectedStress":true,
"Phone":"l",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":true,
"MatchTag":0
},
{
"MemBeginTime":1810,
"MemEndTime":2040,
"PronAccuracy":17.542141,
"DetectedStress":false,
"Phone":"ow",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
}
],
"SessionId":"d0cecf7a-6bca-11ed-bdb0-acde48001122",
"AudioUrl":"",
"Status":"Finished"
}
}

流式评测

需要实时评测或者出现评测超时的问题,可以使用流式评测来解决。

请求参数

主要请求参数
参数名称
类型
描述
WorkMode
Integer
语音输入模式。0:流式评测
UserVoiceData
String
当前语音数据
SeqId
Integer
流式数据包的序号。1:初始化序号,从1开始一次累加
IsEnd
Integer
是否传输完毕标志。1:传输完毕开始评估。0:传输中
SentenceInfoEnabled
Integer
输出断句中间结果标识。1:输出
请求示例
将同一个音频分成三份。
分片序号1 请求
分片序号2 请求
最后分片序号请求
{
"WorkMode":0,
"UserVoiceData":"UklGRka1CQBXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAATElTVDQAAABJTkZPSU*",
"SeqId":1,
"IsEnd":0,
"RefText":"by bus",
"VoiceFileType":3,
"VoiceEncodeType":1,
"SessionId":"85552f20-6bcb-11ed-a4c1-acde48001122",
"EvalMode":1,
"ScoreCoeff":1.0
}
{
"WorkMode":0,
"UserVoiceData":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*",
"SeqId":2,
"IsEnd":0,
"RefText":"by bus",
"VoiceFileType":3,
"VoiceEncodeType":1,
"SessionId":"85552f20-6bcb-11ed-a4c1-acde48001122",
"EvalMode":1,
"ScoreCoeff":1.0
}
{
"WorkMode":1,
"UserVoiceData":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*",
"SeqId":3,
"IsEnd":1,
"RefText":"by bus",
"VoiceFileType":3,
"VoiceEncodeType":1,
"SessionId":"85552f20-6bcb-11ed-a4c1-acde48001122",
"EvalMode":1,
"ScoreCoeff":1.0
}

返回结果

主要返回结果
参数名称
类型
描述
Status
String
评估 session 状态。Finished:评估完成;Evaluating:评估中
返回示例
每一次请求都会有响应的结果。只有当 Status 为 Finished 的时候才会最终结果。
中间结果1
中间结果2
最终结果
{
"Response":{
"SuggestedScore":0,
"PronAccuracy":0,
"PronFluency":-1,
"PronCompletion":0,
"RequestId":"8c82a721-3163-496b-87a2-9e247159d20f",
"Words":[

],
"SessionId":"bb0e64c6-6bd3-11ed-9db2-acde48001122",
"AudioUrl":"",
"SentenceInfoSet":[
{
"SuggestedScore":0,
"PronAccuracy":0,
"PronFluency":-1,
"PronCompletion":0,
"Words":[

],
"SentenceId":-1,
"RefTextId":-1,
"KeyWordHits":[

],
"UnKeyWordHits":[

]
}
],
"Status":"Evaluating",
"RefTextId":-1,
"KeyWordHits":[

],
"UnKeyWordHits":[

]
}
}
{
"Response":{
"SuggestedScore":87.23038440298167,
"PronAccuracy":98.13418,
"PronFluency":0.88928545,
"PronCompletion":0.6666667,
"RequestId":"6841d14b-1e26-400d-9cfb-7a26914eb67a",
"Words":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"PronFluency":0.7536842,
"ReferenceWord":"i_0",
"Word":"i",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"DetectedStress":false,
"Phone":"ay",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1660,
"MemEndTime":1920,
"PronAccuracy":97.68817,
"PronFluency":0.9448819,
"ReferenceWord":"go_1",
"Word":"go",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1660,
"MemEndTime":1780,
"PronAccuracy":98.64847,
"DetectedStress":false,
"Phone":"g",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1780,
"MemEndTime":1920,
"PronAccuracy":96.72788,
"DetectedStress":false,
"Phone":"ow",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1920,
"MemEndTime":2180,
"PronAccuracy":98.834595,
"PronFluency":0.94608915,
"ReferenceWord":"to_2",
"Word":"to",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1920,
"MemEndTime":2020,
"PronAccuracy":98.613686,
"DetectedStress":false,
"Phone":"t",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2020,
"MemEndTime":2180,
"PronAccuracy":99.05552,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":2180,
"MemEndTime":2820,
"PronAccuracy":98.50996,
"PronFluency":0.91248643,
"ReferenceWord":"school_3",
"Word":"school",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":2180,
"MemEndTime":2380,
"PronAccuracy":98.58907,
"DetectedStress":false,
"Phone":"s",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2380,
"MemEndTime":2500,
"PronAccuracy":98.77323,
"DetectedStress":false,
"Phone":"k",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2500,
"MemEndTime":2570,
"PronAccuracy":98.623055,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2570,
"MemEndTime":2820,
"PronAccuracy":98.05444,
"DetectedStress":false,
"Phone":"l",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
}
],
"SessionId":"bb0e64c6-6bd3-11ed-9db2-acde48001122",
"AudioUrl":"",
"SentenceInfoSet":[
{
"SuggestedScore":0,
"PronAccuracy":98.13418,
"PronFluency":0.88928545,
"PronCompletion":0.6666667,
"Words":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"PronFluency":0.7536842,
"ReferenceWord":"i_0",
"Word":"i",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"DetectedStress":false,
"Phone":"ay",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1660,
"MemEndTime":1920,
"PronAccuracy":97.68817,
"PronFluency":0.9448819,
"ReferenceWord":"go_1",
"Word":"go",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1660,
"MemEndTime":1780,
"PronAccuracy":98.64847,
"DetectedStress":false,
"Phone":"g",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1780,
"MemEndTime":1920,
"PronAccuracy":96.72788,
"DetectedStress":false,
"Phone":"ow",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1920,
"MemEndTime":2180,
"PronAccuracy":98.834595,
"PronFluency":0.94608915,
"ReferenceWord":"to_2",
"Word":"to",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1920,
"MemEndTime":2020,
"PronAccuracy":98.613686,
"DetectedStress":false,
"Phone":"t",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2020,
"MemEndTime":2180,
"PronAccuracy":99.05552,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":2180,
"MemEndTime":2820,
"PronAccuracy":98.50996,
"PronFluency":0.91248643,
"ReferenceWord":"school_3",
"Word":"school",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":2180,
"MemEndTime":2380,
"PronAccuracy":98.58907,
"DetectedStress":false,
"Phone":"s",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2380,
"MemEndTime":2500,
"PronAccuracy":98.77323,
"DetectedStress":false,
"Phone":"k",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2500,
"MemEndTime":2570,
"PronAccuracy":98.623055,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2570,
"MemEndTime":2820,
"PronAccuracy":98.05444,
"DetectedStress":false,
"Phone":"l",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
}
],
"SentenceId":-1,
"RefTextId":-1,
"KeyWordHits":[

],
"UnKeyWordHits":[

]
}
],
"Status":"Evaluating",
"RefTextId":-1,
"KeyWordHits":[

],
"UnKeyWordHits":[

]
}
}
{
"Response":{
"SuggestedScore":87.23038440298167,
"PronAccuracy":98.13418,
"PronFluency":0.88928545,
"PronCompletion":0.6666667,
"RequestId":"6841d14b-1e26-400d-9cfb-7a26914eb67a",
"Words":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"PronFluency":0.7536842,
"ReferenceWord":"i_0",
"Word":"i",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1140,
"MemEndTime":1630,
"PronAccuracy":96.12227,
"DetectedStress":false,
"Phone":"ay",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1660,
"MemEndTime":1920,
"PronAccuracy":97.68817,
"PronFluency":0.9448819,
"ReferenceWord":"go_1",
"Word":"go",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1660,
"MemEndTime":1780,
"PronAccuracy":98.64847,
"DetectedStress":false,
"Phone":"g",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":1780,
"MemEndTime":1920,
"PronAccuracy":96.72788,
"DetectedStress":false,
"Phone":"ow",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":1920,
"MemEndTime":2180,
"PronAccuracy":98.834595,
"PronFluency":0.94608915,
"ReferenceWord":"to_2",
"Word":"to",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":1920,
"MemEndTime":2020,
"PronAccuracy":98.613686,
"DetectedStress":false,
"Phone":"t",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2020,
"MemEndTime":2180,
"PronAccuracy":99.05552,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
},
{
"MemBeginTime":2180,
"MemEndTime":2820,
"PronAccuracy":98.50996,
"PronFluency":0.91248643,
"ReferenceWord":"school_3",
"Word":"school",
"MatchTag":0,
"KeywordTag":0,
"PhoneInfos":[
{
"MemBeginTime":2180,
"MemEndTime":2380,
"PronAccuracy":98.58907,
"DetectedStress":false,
"Phone":"s",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2380,
"MemEndTime":2500,
"PronAccuracy":98.77323,
"DetectedStress":false,
"Phone":"k",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2500,
"MemEndTime":2570,
"PronAccuracy":98.623055,
"DetectedStress":false,
"Phone":"uw",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
},
{
"MemBeginTime":2570,
"MemEndTime":2820,
"PronAccuracy":98.05444,
"DetectedStress":false,
"Phone":"l",
"ReferencePhone":"",
"ReferenceLetter":"",
"Stress":false,
"MatchTag":0
}
]
}
],
"SessionId":"bb0e64c6-6bd3-11ed-9db2-acde48001122",
"AudioUrl":"",
"Status":"Evaluating",
"RefTextId":-1,
"KeyWordHits":[

],
"UnKeyWordHits":[

]
}
}