我有个问题。你看,我正在创建这个程序,我想要语音识别。CMUSphinx 4似乎是最好的选择,所以我只是下载了jars并将它们作为压缩库添加到我的项目中。因此,我从CMUSphinx 维基获得了这段代码,并进行了测试。下面是代码:
Configuration configuration = new Configuration();
// Set path to acoustic model.
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
// Set path to dictionary.
configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
// Set language model.
configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.dmp");不幸的是,似乎我得到了这个错误:
属性异常组件:“声学模型加载器”属性:“位置”-无法定位资源:/edu/cmu/sphinx/model/en-us/en-us edu.cmu.sphinx.util.props.InternalConfigurationException:无法定位资源:/edu/cmu/sphinx/model/en-us/en-us
因此,我尝试了故障排除,并添加了额外的"/“到
configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us/");这似乎解决了这部分问题,但在添加额外的“/”之后,我又得到了另一个错误:
由:属性异常组件引起:“字典”属性:“fillerPath”-无法定位resource:/edu/cmu/sphinx/models/en-us/en-us//noisedict edu.cmu.sphinx.util.props.InternalConfigurationException:无法定位resource:/edu/cmu/sphinx/models/en-us/en-us//noisedict
注意额外的"/“在那里。基本上,有没有人有办法避开这样一个事实:我得到了一个错误,不管有没有额外的"/"?在我看来,sphinx4本身的代码出现了错误。我一直试图跟踪额外的"/“是在什么地方添加的,方法是对涉及到错误的每个类进行反编译,而没有任何结果。帮助?
发布于 2015-06-14 21:15:05
我刚刚提交了一个更新,可以让它变得更好,请参见
https://stackoverflow.com/questions/30698687
复制相似问题