[英]How to send request for Non-English voice recognition to wit.ai
When I run my code, wit.ai try to recognize English words of "myspeech.wav" but that is Persian voice, How should I change my code? 当我运行代码时,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
If you set the language in the setting of your app in wit console to Persian , that should works! 如果您在wit console中将应用程序设置中的语言设置为Persian ,那应该可以!
You can alternatively use: 您也可以使用:
curl -XPOST 'https://api.wit.ai/speech' -i -L -H 'Authorization: Bearer YOURAPPTOKEN' -H "Content-Type: audio/wav" --data-binary "@sample.wav"
which returns the JSON of the recognized text, intent, and entities. 它返回识别的文本,意图和实体的JSON。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.