2014-12-18 4 views
0

나는 this tutorial을 따르려고하고 있으며 사전 및 모델과 같은 많은 문제가 발생한 후 시작시 충돌이 발생합니다.startRecognition에서 sphinx-4 NullPointerException이 발생했습니다.

The dictionary is missing a phonetic transcription for the word 'humphrey'

Dec 18, 2014 1:14:50 PM edu.cmu.sphinx.linguist.lextree.HMMTree addPronunciation SEVERE: Missing HMM for unit T with lc=N rc=EH1 13:14:50.601 SEVERE lexTreeLinguist Bad HMM Unit: EH1

나는 this dictionary을로드하고 그 다음이와 충돌 their SourceForge page

에서 언어와 음향 모델을 가지고 :

Exception in thread "main" java.lang.NullPointerException 
    at edu.cmu.sphinx.linguist.lextree.HMMNode.getBaseUnit(HMMTree.java:506) 
    at edu.cmu.sphinx.linguist.lextree.HMMNode.<init>(HMMTree.java:484) 
    at edu.cmu.sphinx.linguist.lextree.Node.addSuccessor(HMMTree.java:165) 
    at edu.cmu.sphinx.linguist.lextree.HMMTree$EntryPoint.createEntryPointMap(HMMTree.java:1163) 
    at edu.cmu.sphinx.linguist.lextree.HMMTree$EntryPointTable.createEntryPointMaps(HMMTree.java:1021) 
    at edu.cmu.sphinx.linguist.lextree.HMMTree.compile(HMMTree.java:795) 
    at edu.cmu.sphinx.linguist.lextree.HMMTree.<init>(HMMTree.java:716) 
    at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist.generateHmmTree(LexTreeLinguist.java:433) 
    at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist.compileGrammar(LexTreeLinguist.java:420) 
    at edu.cmu.sphinx.linguist.lextree.LexTreeLinguist.allocate(LexTreeLinguist.java:337) 
    at edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager.allocate(WordPruningBreadthFirstSearchManager.java:232) 
    at edu.cmu.sphinx.decoder.AbstractDecoder.allocate(AbstractDecoder.java:92) 
    at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:167) 
    at edu.cmu.sphinx.api.LiveSpeechRecognizer.startRecognition(LiveSpeechRecognizer.java:46) 
    at com.test.sphinxtest.App.main(App.java:25) 

여기 내 코드가 있습니다.

package com.test.sphinxtest; 

import java.io.IOException; 

import edu.cmu.sphinx.api.Configuration; 
import edu.cmu.sphinx.api.LiveSpeechRecognizer; 
import edu.cmu.sphinx.api.SpeechResult; 

/** 
* Hello world! 
* 
*/ 
public class App 
{ 
    public static void main(String[] args) 
    { 
     Configuration configuration = new Configuration(); 

     configuration.setAcousticModelPath("models/acousticmodel/en-us"); 
     configuration.setDictionaryPath("dictionary/cmudict-0.6d"); 
     configuration.setLanguageModelPath("models/languagemodel/en-us.lm"); 

     try { 
      LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration); 
      recognizer.startRecognition(true); 
      SpeechResult result = recognizer.getResult(); 
      recognizer.stopRecognition(); 
      while ((result = recognizer.getResult()) != null) { 
       System.out.println(result.getHypothesis()); 
      } 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
    } 
} 

답변

1

올바른 사전이 스트레스 마크가 없어야합니다, 당신은 여기에서 다운로드 할 수 있습니다 : 사전은 "올바른"가 될 수 있도록

https://raw.githubusercontent.com/cmusphinx/pocketsphinx/master/model/en-us/cmudict-en-us.dict

+0

그것은 무엇을 의미 하는가? 어느 것이 "정확"하고 어떤 것이 "부정확"한지 어떻게 알 수 있습니까? – Houseman

+0

사전 phoneset은 어쿠스틱 모델의 phoneset과 일치해야합니다. 일치하는 경우 사전이 틀린 경우 올바르지 않으므로 위와 같은 오류가 발생합니다. 이 문제는 자습서에서 다룹니다. –

+0

이 이슈는이 자습서에서 어디에서 다루고 있습니까? 어쩌면 나는 잘못된 튜토리얼을 보거나, 순서가 어긋나거나 뭔가 따라 가고있을 것이다. – Houseman