使用sphinx4 .jar转换为.dll的C#程序失败

时间:2018-09-27 14:11:32

标签: ikvm sphinx4

当我尝试实例化LiveSpeechRecognizer时,它将引发错误,并给出以下堆栈跟踪:

Exception thrown: 'edu.cmu.sphinx.util.props.PropertyException' in VoiceRecognition.dll
   at edu.cmu.sphinx.frontend.AutoCepstrum.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(String instanceName)
   at edu.cmu.sphinx.util.props.PropertySheet.getComponentList(String name, Class tclass)
   at edu.cmu.sphinx.frontend.FrontEnd.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.PropertySheet.getComponent(String name)
   at edu.cmu.sphinx.decoder.scorer.SimpleAcousticScorer.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.PropertySheet.getComponent(String name)
   at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstLookaheadSearchManager.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.PropertySheet.getComponent(String name)
   at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.decoder.Decoder.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.PropertySheet.getComponent(String name)
   at edu.cmu.sphinx.recognizer.Recognizer.newProperties(PropertySheet ps)
   at edu.cmu.sphinx.util.props.PropertySheet.getOwner()
   at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(String instanceName)
   at edu.cmu.sphinx.api.Context..ctor(String path, Configuration config)
   at edu.cmu.sphinx.api.Context..ctor(Configuration config)
   at edu.cmu.sphinx.api.AbstractSpeechRecognizer..ctor(Configuration configuration)
   at edu.cmu.sphinx.api.LiveSpeechRecognizer..ctor(Configuration configuration)
   at TestingStandaloneCSVoiceRecognition.Program..ctor()

我一直在尝试浏览文档和代码以弄清是什么原因,但是到目前为止我运气不好。我可能应该注意,我使用IKVM将.jars转换为.dll,我已经导入到Visual Studio C#项目中。LiveSpeechRecognizer甚至在引发错误之前还没有完成实例化。我已经确保已导入所有依赖项,所以这不是问题。java程序运行正常。 / p>

1 个答案:

答案 0 :(得分:0)

从C#调用Java代码不是一个好主意,相反,您可以简单地将Pocketsphinx dll与C#API一起使用,请参见

https://github.com/cmusphinx/pocketsphinx/tree/master/swig/csharp