参见:https://issuetracker.google.com/u/1/issues/128352542
我们遇到的问题是,用户语音环境中添加的某些单词未被返回或优先排序。
使用短语提示时,API通常会正确转录发出时提供的短语或单词,但无论您如何在短语提示中添加单词,都不会转录某些单词。
在StreamingRecognitionConfig中发送配置:
{
"config":{
"encoding":"LINEAR16",
"sampleRateHertz":8000,
"languageCode":"en-US",
"enableWordTimeOffsets":true,
"enableAutomaticPunctuation":false,
"model":"default",
"useEnhanced":true,
"speechContexts":[
{
"phrases":[
"Bill Uhma",
"Uhma",
"I got coffee with Bill Uhma"
]
}
]
}
}
试图说“我和Bill Uhma喝咖啡”时的结果:
{
"results":{
"alternatives":[
{
"confidence":0.8440007,
"transcript":"I got coffee with Bill Uma",
"words":[
{
"confidence":0.847875,
"word":"I"
},
{
"confidence":0.9265712,
"word":"got"
},
{
"confidence":0.98762906,
"word":"coffee"
},
{
"confidence":0.98762906,
"word":"with"
},
{
"confidence":0.9239746,
"word":"Bill"
},
{
"confidence":0.23432566,
"word":"Uma"
}
]
},
{
"confidence":0.94561315,
"transcript":"I got coffee with Bill Luma"
},
{
"confidence":0.911253,
"transcript":"I got coffee with Bill Guma"
},
{
"confidence":0.91219664,
"transcript":"I got coffee with Bill Houma"
},
{
"confidence":0.94028026,
"transcript":"I got coffee with Bill looma"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill bouma"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill goomah"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill Wilma"
},
{
"confidence":0.938467,
"transcript":"I got coffee with Bill Boomer"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill buma"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill Ooma"
},
{
"confidence":0.9403957,
"transcript":"I got coffee with Bill Gooma"
}
],
"confidence":0.8440007,
"is_final":true,
"transcription":"I got coffee with Bill Uma"
}
}
收到的转录是“我和Bill Uma喝咖啡”。
预期的转录是“我和Bill Uhma喝咖啡”。
如结果所示,提供的提示不会出现在收到的12个备选方案中的任何一个中。
分离短语提示并仅发送其中一个对结果没有影响。
这实际上不是一个错误,而应该被视为一个功能请求,强制识别器使用提供的phrases/hints特别是如果短语中的单词/ s在其词汇表中不存在。如果您注意到,单词“Uma”的置信度非常低,这可能表明识别器不理解它(不在其词汇表中)。