如何将非英语语音识别请求发送到 wit.ai
How to send request for Non-English voice recognition to wit.ai
当我 运行 我的代码时,wit.ai 尝试识别 "myspeech.wav" 的英文单词,但那是波斯语语音,我应该如何更改我的代码?
def RecognizeSpeech(AUDIO_FILENAME):
audio = open('myspeech.wav','r')
headers = {'authorization': 'Bearer ' + wit_access_token,
'Content-Type': 'audio/wav'}
resp = requests.post(API_ENDPOINT, headers = headers,
data = audio)
data = json.loads(resp.content)
text = data['_text']
return text
如果您在控制台的应用程序设置中将语言设置为波斯语,那应该可以!
您也可以使用:
curl -XPOST 'https://api.wit.ai/speech' -i -L -H 'Authorization: Bearer YOURAPPTOKEN' -H "Content-Type: audio/wav" --data-binary "@sample.wav"
其中 returns 已识别文本、意图和实体的 JSON。
当我 运行 我的代码时,wit.ai 尝试识别 "myspeech.wav" 的英文单词,但那是波斯语语音,我应该如何更改我的代码?
def RecognizeSpeech(AUDIO_FILENAME):
audio = open('myspeech.wav','r')
headers = {'authorization': 'Bearer ' + wit_access_token,
'Content-Type': 'audio/wav'}
resp = requests.post(API_ENDPOINT, headers = headers,
data = audio)
data = json.loads(resp.content)
text = data['_text']
return text
如果您在控制台的应用程序设置中将语言设置为波斯语,那应该可以!
您也可以使用:
curl -XPOST 'https://api.wit.ai/speech' -i -L -H 'Authorization: Bearer YOURAPPTOKEN' -H "Content-Type: audio/wav" --data-binary "@sample.wav"
其中 returns 已识别文本、意图和实体的 JSON。