JAVA使用谷歌的语音识别API [英] JAVA using google speech recognition API

查看:992
本文介绍了JAVA使用谷歌的语音识别API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用谷歌语音识别API。这里的code我已经写了:

I'm trying to use google speech recognition API. Here's the code i've written:

http://pastebin.com/zJEhnJ74

它的工作原理。我从服务器得到一个答案:

It works. I get an answer from the server:

{"status":5,"id":"8803471b14a2310dfcf917754e8bd4a7-1","hypotheses":[]}

现在的问题是状态:5。逸岸,这里的状态code:

Now the problem is "status:5". Infact, here's status code:

status: 0 – correct
, status: 4 – missing audio file, 
status: 5 – incorrect audio file.

我的问题是不正确的音频文件。如果它是一个.FLAC文件错误(你可以在这里下载我的测试.FLAC文件我不明白:<一href=\"http://www21.zippyshare.com/v/61888405/file.html\">http://www21.zippyshare.com/v/61888405/file.html)或如何读取文件(一个字节数组,然后把它转换成字符串)

My problem is "incorrect audio file". I don't understand if it is a .flac file error (you can download my test .flac file here: http://www21.zippyshare.com/v/61888405/file.html) or how i read the file (in a byte array then convert it into string)

感谢您的帮助!和对不起我的英语不好

Thanks for help! and sorry for my bad english

推荐答案

您必须使用 wr.write(数据); 而不是 WR的。 writeBytes(新的String(数据));

谷歌回答:

{"status":0,"id":"e0f4ced346ad18bbb81756ed4d639164-1","hypotheses":[{"utterance":"hello how are you","confidence":0.94028234},{"utterance":"hello how r you"},{"utterance":"hello how are u"},{"utterance":"hello how are you in"}]}

这篇关于JAVA使用谷歌的语音识别API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆