【问题标题】:Sphinx .InternalConfigurationException狮身人面像 .InternalConfigurationException
【发布时间】:2015-10-08 05:13:20
【问题描述】:

执行我,我需要帮助如何使用 Sphinx4 API,我创建了新的 maven 项目,我按照此链接 How to depend on this maven project 在此处制作 pom.xml 文件我的 pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany.app</groupId>
    <artifactId>my-app</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>my-app</name>
    <url>http://maven.apache.org</url>
    <repositories>
        <repository>
            <id>snapshots-repo</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>edu.cmu.sphinx</groupId>
            <artifactId>sphinx4-core</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>edu.cmu.sphinx</groupId>
            <artifactId>sphinx4-data</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>

然后我在此链接https://github.com/cmusphinx/sphinx4/blob/master/sphinx4-samples/src/main/java/edu/cmu/sphinx/demo/dialog/DialogDemo.java 中尝试 Sphinx DialogDemo 但我收到此错误

------------------------------------------------------------------------
Building my-app 1.0-SNAPSHOT
------------------------------------------------------------------------

--- exec-maven-plugin:1.2.1:exec (default-cli) @ my-app ---
Exception in thread "main" Property exception component:'jsgfGrammar' property:'grammarLocation' - Can't locate resource:/edu/cmu/sphinx/demo/dialog/
edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/edu/cmu/sphinx/demo/dialog/
    at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.getResource(ConfigurationManagerUtils.java:468)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.newProperties(JSGFGrammar.java:228)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:222)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:177)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
    at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:81)
    at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:36)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:296)
    at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:86)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:518)
    at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:163)
    at edu.cmu.sphinx.api.Context.<init>(Context.java:73)
    at edu.cmu.sphinx.api.Context.<init>(Context.java:45)
    at edu.cmu.sphinx.api.AbstractSpeechRecognizer.<init>(AbstractSpeechRecognizer.java:44)
    at edu.cmu.sphinx.api.LiveSpeechRecognizer.<init>(LiveSpeechRecognizer.java:34)
    at com.mycompany.spechrecognizer.DialogDemo.main(DialogDemo.java:138)

我该怎么办??

【问题讨论】:

    标签: java cmusphinx sphinx4


    【解决方案1】:

    为您的项目添加所需的语法资源。

    修复源代码中资源的路径。如果你的类是com.mycompany.spechrecognizer,那么资源URL可能也是resource:/com/mycompany/spechrecognizer/

    【讨论】:

    • 谢谢@barryhunter,我已将资源更改为 com/mycompany/spechrecognizer/garmmar,但我仍然遇到另一个错误:
    • 这里是我的错误@Nikolay 异常在线程“main”java.lang.IllegalStateException: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame ,不支持小端序。在 edu.cmu.sphinx.api.Microphone.(Microphone.java:38) 在 edu.cmu.sphinx.api.SpeechSourceProvider.getMicrophone(SpeechSourceProvider.java:18) 在 edu.cmu.sphinx.api.LiveSpeechRecognizer .(LiveSpeechRecognizer.java:35) at com.mycompany.spechrecognizer.DialogDemo.main(DialogDemo.java:142)
    • Caused by: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported. at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:513) at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:124) at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:416)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-31
    • 2015-04-22
    相关资源
    最近更新 更多