2016-06-12 15 views
1

我使用下面的語法:獅身人面像使用JSGF語法與重量:顯示java.lang.NullPointerException異常

#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 ; 

一切運作良好,除非我添加砝碼。配重塊運行:​​

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

我收到以下錯誤:

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

我使用語法的方法是:

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); 

回答

1

我爲延遲對不起,這個問題有在修訂版13217中被固定在主幹中,請更新並重試,它應該起作用。