狮身人面像.Internal ConfigurationException

Sphinx .InternalConfigurationException

对不起,我需要帮助如何使用 Sphinx4 API,我已经创建了新的 maven 项目,我按照这个 link 来制作 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>

然后我在这个 Link 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)

我该怎么办??

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

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