为什么这会显示一个空指针异常?

时间:2018-04-07 17:59:30

标签: java netbeans nullpointerexception

package sphinxtest;

导入edu.cmu.sphinx.api.Configuration;

导入edu.cmu.sphinx.api.LiveSpeechRecognizer;

导入edu.cmu.sphinx.api.SpeechResult;

import java.io.IOException;

公共课Sphinxtest {

/**
 * @param args the command line arguments
 * @throws java.io.IOException

 */
public static void main(String[] args) throws IOException {

    System.out.println("running");

    Configuration config = new Configuration();

     config.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
     config.setDictionaryPath("C:\\Users\\sys\\Desktop\\3481.dic");
     config.setLanguageModelPath("C:\\Users\\sys\\Desktop\\3481.dic");

     LiveSpeechRecognizer rec = new LiveSpeechRecognizer (config);
     rec.startRecognition(true);

     SpeechResult spinput ;
     while ( ( spinput = rec.getResult() ) != null) {

         String command = spinput.getHypothesis();

         if (command.equalsIgnoreCase("click")){

             System.out.println("click command recieved");


         }




}

}

}``

0 个答案:

没有答案