当我查看Developer.ATT.com上的文档时,我看到了应该使用的格式(代码)示例:
POST https://api.att.com/speech/v3/speechToTextCustom HTTP/1.1
Host: api.att.com
Authorization: Bearer 38C2399A23999
X-SpeechContext: GrammarList
Accept: application/json
Content-length: 7012
Content-Language: en-us
Content-type: multipart/x-srgs-audio; boundary=----------------------------46ef33c653e2
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-dictionary"; filename="speech_alpha.pls"
Content-Type: application/pls+xml
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0" alphabet="sampa" xml:lang="en-US">
<lexeme>
<grapheme>Qiang</grapheme>
<phoneme>tS { n</phoneme>
</lexeme>
</lexicon>
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-grammar"
Content-Type: application/srgs+xml
<grammar root="top" xml:lang="en-US">
<rule id="CONTACT">
<one-of>
<item>Qiang</item>
<item>David</item>
</one-of>
</rule>
<rule id="top" scope="public">
<item>
<one-of>
<item>text</item>
<item>send message to</item>
</one-of>
</item>
<ruleref uri="#CONTACT"/>
</rule>
</grammar>
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-voice"; filename="speech_ex.amr"
Content-Type: audio/amr
{{...audio data...}}
------------------------------45ef33c653e2-- 既然我在工作上遇到了困难,我想知道我是否也应该把这篇文章的字典和语法部分也包括进去?为什么?
发布于 2015-05-26 17:46:38
要使用定制语音引擎(对于非标准语言),语法文件是必需的,因为每当使用定制语音引擎时,都需要提供用于转录的词汇表。你可以在没有语法文件的情况下使用常规的语音API进行转录,但它可能不包括你想要做的事情。看起来,您正在尝试利用AT&T自定义语音引擎提供的大量非英语语言。所有这些语言都要求您提供一个语法文件才能工作。支持的非自定义语言是美国英语和美国西班牙语。
https://stackoverflow.com/questions/30464618
复制相似问题