0
Execuse我,我需要幫助如何使用Sphinx4 API,我已創建新的Maven項目,我請點擊此鏈接How to depend on this maven project,使pom.xml文件在這裏我的pom.xml:獅身人面像.InternalConfigurationException
<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>
,然後我是嘗試獅身人面像DialogDemo此Link https://github.com/cmusphinx/sphinx4/blob/master/sphinx4-samples/src/main/java/edu/cmu/sphinx/demo/dialog/DialogDemo.java ,但我得到這個錯誤
------------------------------------------------------------------------
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)
我應該怎麼辦?
謝謝@barryhunter我必須改變資源COM/myCompany中/ spechrecognizer/garmmar,但我仍然得到另一個錯誤: –
這裏是我的錯誤@Nikolay 異常在線程「main」中java.lang.IllegalStateException:javax.sound.sampled.LineUnavailableException:具有PCM_SIGNED格式的行16000.0 Hz,16位,單聲道,2字節/幀,不支持little-endian。 \t at edu.cmu.sphinx.api.Microphone。(Microphone.java:38) \t在edu.cmu.sphinx.api.SpeechSourceProvider.getMicrophone(SpeechSourceProvider.java:18) \t在edu.cmu.sphinx.api.LiveSpeechRecognizer。 (LiveSpeechRecognizer.java:35) \t在com.mycompany.spechrecognizer.DialogDemo.main(DialogDemo.java:142) –
'引起:javax.sound.sampled.LineUnavailableException:用格式線PCM_SIGNED 16000.0赫茲,16比特,單聲道,2字節/幀,不支持little-endian。 在com.sun.media.sound.DirectAudioDevice $ DirectDL.implOpen(DirectAudioDevice.java:513) \t在com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:124) \t在的com.sun。 media.sound.AbstractDataLine.open(AbstractDataLine.java:416)' –