语音识别REST API问题及答案汇总贴
gpluscat:
let params: [String: AnyObject] = ["format": "wav", "rate": 8000, "channel": 1, "cuid": "ef0d06fef07e3c3f3c03853101133f79c3d6ae05", "token": token, "speech": speech, "len": len]
Alamofire.request(.POST, "http://vop.baidu.com/server_api", parameters: params, encoding: .JSON, headers: ["Content-Type": "application/json;charset=UTF-8"]).responseJSON { (response: Response) in
print(">>>>>>>>>>response \(response)")
}
为什么返回3300,参数错误,并没有错呀
回复gpluscat:上传的地址是不是 url="http://vop.baidu.com/server_api"? json格式url中不要加参数
python写的识别程序,调试通过.
def recognize( filepath, ftype, frate, token, fchannel ):
fh = open( filepath ,'rb')
content = fh.read()
f_len = os.path.getsize( filepath )
speech = base64.b64encode(content)
fh.close()
# 表示本机的id,使用mac地址标识
cuid = "40-8D-5C-73-00-78"
url="http://vop.baidu.com/server_api"
update = json.dumps({'format':ftype,'rate':frate,'channel':fchannel,'cuid':cuid,'token':token,'speech':speech,'len':f_len})
r = urllib2.urlopen( url ,update)
result = json.loads( r.read() )
err_no = result['err_no']
if err_no == 0:
text = result['result'][0]
else:
text = err_map( err_no )
print "DEBUG, Error:" ,text.encode('cp936')
return err_no, text
目前语言识别REST API只支持中文播报,什么时候支持如英文等语种的播报?
HTTP Error 413: Request Entity Too Large
这个具体是什么问题
我是用php实例做的测试语音识别功能的,有以下几个问题:
1 文件中的test.pcm,是不是就是要转换的语音文件?
2 在linux系统下怎么得到pcm语音文件
3 怎么使用mav文件进行语音识别
4 怎么提高mwa的识别率
测试官方例子 里面cuid需要填什么
报错
Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
at org.json.JSONObject.(JSONObject.java:197)
at org.json.JSONObject.(JSONObject.java:324)
合成的文本可以持续保存吗
问题:
REST API语音识别错误代码:3301,是什么原因?
回答:
主要原因可能有:
1、语音格式不正确。
2、语音质量有问题,模糊不清或者静音。
REST API方式是否支持语义理解?
REST API方式不支持语义理解。如果想使用语义理解功能,请用SDK版本。
gpluscat:
let params: [String: AnyObject] = ["format": "wav", "rate": 8000, "channel": 1, "cuid": "ef0d06fef07e3c3f3c03853101133f79c3d6ae05", "token": token, "speech": speech, "len": len]
Alamofire.request(.POST, "http://vop.baidu.com/server_api", parameters: params, encoding: .JSON, headers: ["Content-Type": "application/json;charset=UTF-8"]).responseJSON { (response: Response) in
print(">>>>>>>>>>response \(response)")
}
为什么返回3300,参数错误,并没有错呀
回复gpluscat:上传的地址是不是 url="http://vop.baidu.com/server_api"? json格式url中不要加参数
python写的识别程序,调试通过.
def recognize( filepath, ftype, frate, token, fchannel ):
fh = open( filepath ,'rb')
content = fh.read()
f_len = os.path.getsize( filepath )
speech = base64.b64encode(content)
fh.close()
# 表示本机的id,使用mac地址标识
cuid = "40-8D-5C-73-00-78"
url="http://vop.baidu.com/server_api"
update = json.dumps({'format':ftype,'rate':frate,'channel':fchannel,'cuid':cuid,'token':token,'speech':speech,'len':f_len})
r = urllib2.urlopen( url ,update)
result = json.loads( r.read() )
err_no = result['err_no']
if err_no == 0:
text = result['result'][0]
else:
text = err_map( err_no )
print "DEBUG, Error:" ,text.encode('cp936')
return err_no, text
目前语言识别REST API只支持中文播报,什么时候支持如英文等语种的播报?
HTTP Error 413: Request Entity Too Large
这个具体是什么问题
let params: [String: AnyObject] = ["format": "wav", "rate": 8000, "channel": 1, "cuid": "ef0d06fef07e3c3f3c03853101133f79c3d6ae05", "token": token, "speech": speech, "len": len]
Alamofire.request(.POST, "http://vop.baidu.com/server_api", parameters: params, encoding: .JSON, headers: ["Content-Type": "application/json;charset=UTF-8"]).responseJSON { (response: Response) in
print(">>>>>>>>>>response \(response)")
}
为什么返回3300,参数错误,并没有错呀
我是用php实例做的测试语音识别功能的,有以下几个问题:
1 文件中的test.pcm,是不是就是要转换的语音文件?
2 在linux系统下怎么得到pcm语音文件
3 怎么使用mav文件进行语音识别
4 怎么提高mwa的识别率
测试官方例子 里面cuid需要填什么
报错
Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
at org.json.JSONObject.(JSONObject.java:197)
at org.json.JSONObject.(JSONObject.java:324)
合成的文本可以持续保存吗
问题:
REST API语音识别错误代码:3301,是什么原因?
回答:
主要原因可能有:
1、语音格式不正确。
2、语音质量有问题,模糊不清或者静音。
问题:
REST API方式是否支持语义理解?
回答:
REST API方式不支持语义理解。如果想使用语义理解功能,请用SDK版本。