java - 无法在 sphinx4 中加载 en-us-semi 模型

标签 java c cmusphinx sphinx4 pocketsphinx

我最近的任务是用 Java 重写一个 C 服务器,这意味着将其语音识别功能从 Pocketsphinx C api 迁移到 Sphinx4 Java API,使用与那些工作相同的字典和语言模型文件使用 Pocketsphinx 加上 CMU Sphinx 在其网站上提供的默认 en-us-semi 声学模型。一个注意事项:使用 Pocketsphinx 不需要声学模型,所以我选择了 en-us-semi 模型,认为它可以满足我的需求。这样做时,我在使用以下代码将 StreamSpeechRecognizer 初始化为 Spring bean 时遇到错误:

@Bean
@Autowired
public StreamSpeechRecognizer streamSpeechRecognizer(SphinxProperties sphinxProperties) throws
                                                                                      IOException {
edu.cmu.sphinx.api.Configuration sphinxConfiguration = new edu.cmu.sphinx.api.Configuration();
sphinxConfiguration.setAcousticModelPath("resource:/" + sphinxProperties.getAcousticModelPath());
sphinxConfiguration.setDictionaryPath("resource:/" +  sphinxProperties.getDictionaryPath());
sphinxConfiguration.setLanguageModelPath("resource:/" + sphinxProperties.getLanguageModelPath());

return new StreamSpeechRecognizer(sphinxConfiguration);

我得到的错误如下:

Caused by: java.lang.AssertionError
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.createSenonePool(Sphinx3Loader.java:484)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.loadModelFiles(Sphinx3Loader.java:386)
at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.load(Sphinx3Loader.java:315)
at edu.cmu.sphinx.frontend.AutoCepstrum.newProperties(AutoCepstrum.java:118)
at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:508)

它由 StreamSpeechRecongizer 的构造函数抛出。

断言失败是assert numVariances == numSenones * numGaussiansPerSenone;

另外,如果您知道我使用的词典文件包含普通英语单词(例如 potato)以及互联网服务名称(例如 Hotmail、Facebook、Twitter 等),这对您可能会有用。

如果您能提供任何帮助,我们将不胜感激。非常感谢。

最佳答案

您需要使用最新版本的 sphinx4-5prealpha,如 http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4 中所述

它与默认的 en-us 通用 ptm 5.2 模型一起使用,这是可用的最准确的模型。您需要使用默认的 sphinx4 模型,而不是 en-us semi。最新的 pocketsphinx 使用相同的模型。

sphinx4 不支持 en-us-semi

关于java - 无法在 sphinx4 中加载 en-us-semi 模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29067977/

相关文章:

c - 如何调整此代码以允许未指定数量的正整数

ios - 使用 clang xcode 9 为 iOS armv7+arm64 编译 C 代码

c - 使用结构体 C 编程理解变量

eclipse - 不知道要开始测试sphinx4的类

java - SaxLoader 中的 Sphinx4 空指针异常

java - 在启用远程管理的情况下运行 java 进程

java - 在后台停止java程序

java - 生命游戏未正确重置

java - 什么是用于终端应用程序的好的 Java、curses 类库?

ios - 尝试使用法国声学模型