0

I am implementing sphinx-4 tutorial. But when run this tutorial I got

Exception in thread "main" Property exception component:'acousticModelLoader' property:'location' - Can't locate resource:/edu/cmu/sphinx/models/en-us/en-us
edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource:/edu/cmu/sphinx/models/en-us/en-us

This is code I am using

        Configuration configuration = new Configuration();
        configuration.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
        configuration.setDictionaryPath("resource:/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
        configuration.setLanguageModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us.lm.bin");

I have also add both to pom.xml and also add repositories to pom.xml, as mentioned in tutorial.

<dependency>
            <groupId>edu.cmu.sphinx</groupId>
            <artifactId>sphinx4-core</artifactId>
            <version>5prealpha-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>edu.cmu.sphinx</groupId>
            <artifactId>sphinx4-data</artifactId>
            <version>5prealpha-SNAPSHOT</version>
        </dependency>

What I am doing wrong? I am using windows 10 OS. Comment on this question told something about classpath But it is not clear.

Community
  • 1
  • 1
mubeen
  • 813
  • 2
  • 18
  • 39
  • The solution is the same as in previous question: The error is due to the fact you didn't add sphinx4-data jar into your application classpath. In order to get help on this issue you need to explain how exactly do you add jars into classpath and how do you run your project. – Nikolay Shmyrev Aug 08 '16 at 05:32
  • @NikolayShmyrev I am using maven to add dependencies. I am adding sphinx4-data in maven pom.xml. I was having problem in one computer. Now, I run on another computer with same tutorial, project is running fine. – mubeen Aug 08 '16 at 07:09
  • I asked how do you start the software, now how you compile it – Nikolay Shmyrev Aug 10 '16 at 15:36

2 Answers2

0

I had the same problem. I used same jre version, same eclipse version and same workspace(copy-paste) on five different computers. sphinx4 worked on four of them and didn't work on the other one. I had the same error:

Can't locate resource:/edu/cmu/sphinx/models/en-us/en-us

I do not know why that is happenning. Four of the computers is working well with Maven. As a solution to save the day, I downloaded Acoustic Model and Dictionary for the other computer. Then, I gave the local paths.

static String DictionaryPath = "file:C:\\Users\\user\\workspace\\MyProject\\cmudict\\cmudict.dict";
static String AcousticModelPath = "file:C:\\Users\\user\\workspace\\MyProject\\acoustic model\\cmusphinx-en-us-8khz-5.2";

So, this is not an actual solution, also it is incompatible with the Maven logic but it works.

Alperen
  • 3,772
  • 3
  • 27
  • 49
0

Specified the path manually under ubuntu and it worked

String AcousticModelPath = "/home/eclipse-workspace/speech/sound/en-us";
String DictionaryPath = "/home/eclipse-workspace/speech/sound/cmudict-en-us.dict";
String languageModelPath="/home/eclipse-workspace/speech/sound/en-us.lm.bin";