Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
78 views
in Technique[技术] by (71.8m points)

cmusphinx - Property exception component:'wsjLoader'

In recent days I have been reading alot about modifying the HelloWorld demo file & adding new words in it of our own choice. But I am encountering a serious problem which I am unable to counter. I am listing down my steps & then the error program is giving me. Any help is much appreciated!

  • First I extracted the WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz jar file. And then I added some new words & their pronounciations in cmudict.0.6d file. After I saved it & compressed it back to jar file using a jar file maker.
  • The same step I repeated with HelloWorld jar file. After extracting I modified its hello.gram file by adding new words (the words which I inserted in dictionary as well as few words that were already there in dictionary e.g. John) Then I compressed it back using the same step & loaded both files on Eclipse. But both of them giving me a similar error. While the original demo files are working fine, these two files that I modified are not working anymore.

If I am replacing helloworld.jar file then I get this error:

Exception in thread "main" Property exception component:'jsgfGrammar' property:'grammarLocation' - Can't locate resource:/edu/cmu/sphinx/demo/helloworld/
edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/edu/cmu/sphinx/demo/helloworld/
    at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.getResource(ConfigurationManagerUtils.java:483)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.newProperties(JSGFGrammar.java:232)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:246)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:182)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:65)
    at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:37)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:90)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:161)
    at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:36)

and if I'm replacing WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz.jar

 Exception in thread "main" Property exception component:'wsjLoader' property:'location' - Can't locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/WSJ_8gau_13dCep_16k_40mel_130Hz_6800Hz
    at edu.cmu.sphinx.util.props.ConfigurationManagerUtils.getResource(ConfigurationManagerUtils.java:483)
    at edu.cmu.sphinx.linguist.acoustic.tiedstate.Sphinx3Loader.newProperties(Sphinx3Loader.java:243)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.linguist.acoustic.tiedstate.TiedStateAcousticModel.newProperties(TiedStateAcousticModel.java:102)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.setupAcousticModel(FlatLinguist.java:278)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.newProperties(FlatLinguist.java:244)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.newProperties(SimpleBreadthFirstSearchManager.java:182)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.decoder.AbstractDecoder.newProperties(AbstractDecoder.java:65)
    at edu.cmu.sphinx.decoder.Decoder.newProperties(Decoder.java:37)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.PropertySheet.getComponent(PropertySheet.java:287)
    at edu.cmu.sphinx.recognizer.Recognizer.newProperties(Recognizer.java:90)
    at edu.cmu.sphinx.util.props.PropertySheet.getOwner(PropertySheet.java:505)
    at edu.cmu.sphinx.util.props.ConfigurationManager.lookup(ConfigurationManager.java:161)
    at edu.cmu.sphinx.demo.helloworld.HelloWorld.main(HelloWorld.java:36)

Although I know there is some problem with locating the files but I'm not getting how to fix it. Also can it be a reason that I might be compressing the jar files back in a wrong way? But keep that in mind that original demo files are working fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You made it wrong from the beginning, you should have used updated version sphinx4-5prealpha which is much easier to use. You should not repackage any sphinx4 jars. Here are the steps you need to make to create an application using sphinx4 and recognizing a custom grammar:

  1. Setup a new java application in your IDE

  2. Add sphinx4 dependency with jars or with maven/gradle.

  3. Write grammar as requested and add it into application resources.

  4. Write dictionary as requested and add it to application resources.

  5. Copy SpeechRecognizer code from tutorial and modify path according to the location of the resources you created.

For more details, see sphinx4 tutorial


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...