grammarvoice-recognitionsphinx4

sphinx using JSGF grammar with weights: java.lang.NullPointerException exception


I am using the following grammar:

#JSGF V1.0;
grammar tag;
public <tag> = <tagPart> +; 
<tagPart> =  <digit> |  <letter>;

<digit> = oh  | zero | one   | two | three | four | five  | six   |seven | eight | nine  ;
<letter> = a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z ;

Everything works well unless I add weights. Running with weights:

<tagPart> = /0.8/ <digit> | /0.1/ <letter>;

I am getting the following error:

Exception in thread "main" java.lang.NullPointerException
    at edu.cmu.sphinx.jsgf.JSGFGrammar.getNormalizedWeights(JSGFGrammar.java:49)

The way I am using grammar is:

Configuration configuration = new Configuration();
configuration.setAcousticModelPath("file:/E/sphinx4-5prealpha-src/sphinx4-data/src/main/resources/edu/cmu/sphinx/models/en-us/en-us");
configuration.setDictionaryPath("file:/E/sphinx4-5prealpha-src/sphinx4-data/src/main/resources/edu/cmu/sphinx/models/en-us/cmudict-en-us.dict");
configuration.setGrammarPath("file:/E/sT/src/main/resources/");
configuration.setGrammarName("tag");
configuration.setUseGrammar(true);
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);

Solution

  • I'm sorry for delay, this issue has been just fixed in trunk in revision 13217, please update and try again, it should work.