2016-09-15 35 views
1

我的名字是masoud。 現在我想說當我說masoud,我的應用程序打印一個控制檯日誌。電話'MA'在聲學模型中發聲;單詞'masoud' - pocketsphinx

做到這一點我做了一個mdic.txt文件,我把我的名字裏面:

馬蘇德MA S 0 d

我改變mdic.txtmdic.dict,並把它在assets/sync direcotry。

我做了一個cm.txt文件,我把一個字符串裏面:

#JSGF V1.0; 
/** 
* JSGF Grammar for Hello World example 
*/ 
grammar masoud; 
public <greet> = (good morning | masoud) (bhiksha | evandro | paul | philip | rita | will); 

和我改變cm.txtcm.gram

在我的MainActivity

private void setupRecognizer(File assetsDir) throws IOException { 
    // The recognizer can be configured to perform multiple searches 
    // of different kind and switch between them 

    recognizer = SpeechRecognizerSetup.defaultSetup() 
      .setAcousticModel(new File(assetsDir, "en-us-ptm")) 
      //.setDictionary(new File(assetsDir, "cmudict-en-us.dict")) 
      .setDictionary(new File(assetsDir, "mdic.dict")) 
      //.setRawLogDir(assetsDir) // To disable logging of raw audio comment out this call (takes a lot of space on the device) 
      .setKeywordThreshold(1e-45f) // Threshold to tune for keyphrase to balance between false alarms and misses 
      .setBoolean("-allphone_ci", true) // Use context-independent phonetic search, context-dependent is too slow for mobile 


      .getRecognizer(); 
    recognizer.addListener(this); 

    /** In your application you might not need to add all those searches. 
    * They are added here for demonstration. You can leave just one. 
    */ 

    // Create keyword-activation search. 
    //recognizer.addKeyphraseSearch(KWS_SEARCH, KEYPHRASE); 

    recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "mdic.dict")); 

現在我得到這個消息:

「dict.c」,行195:1號線:電話 '馬' 是聲學 模型mising;單詞「馬蘇德」忽略「kws_search.c」,行171:這個詞 「馬蘇德」缺少字典中的

我在recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "mdic.dict"));線得到這個錯誤。

+0

masoud的正確轉錄是「M AH S UW D」 –

回答

1

masoud的正確轉錄是「M AH S UW D」。

聲學模型中沒有手機MA。錯誤就是這樣說的。

+0

如何知道單詞的正確轉錄? –

+0

http://cmusphinx.sourceforge.net/wiki/tutorialdict –