在Java中使用Voce语音识别

时间:2014-07-13 09:15:36

标签: java speech-recognition speech-to-text

我一直试图让语音识别能够在Java应用程序上运行,我已经尝试过Sphinx,但它太复杂了我所需要的,所以我找到了Voce。 我试图让识别演示工作。 问题是我无法初始化SpeechInterface,这是我一直在使用的代码:

voce.SpeechInterface.init("C:/Users/G/Documents/NetBeansProjects/VoceTest/lib",
            false,
            true,
            "C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram",
            "digits");

我在lib文件夹里面的gram文件夹中有一个名为digits.gram的语法文件。 结果我得到了:

[Voce ERROR] Cannot configure speech recognizer: 
Property Exception component:'jsgfGrammar' property:'grammarLocation' - value        (C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram) is not a valid Resource
at edu.cmu.sphinx.util.props.ValidatingPropertySheet.setRaw(ValidatingPropertySheet.java:137)
at edu.cmu.sphinx.util.props.ConfigurationManager.setProperty(ConfigurationManager.java:250)
at voce.SpeechRecognizer.<init>(SpeechRecognizer.java:85)
at voce.SpeechInterface.init(SpeechInterface.java:79)
at vocetest.VoceTest.main(VoceTest.java:18)

我看了docs,但我无法弄清楚我做错了什么

1 个答案:

答案 0 :(得分:0)

"file:/C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram","digits");"

上述行应该没有错误。

相关问题