我的名字是masoud
。 現在我想說當我說masoud
,我的應用程序打印一個控制檯日誌。電話'MA'在聲學模型中發聲;單詞'masoud' - pocketsphinx
做到這一點我做了一個mdic.txt
文件,我把我的名字裏面:
馬蘇德MA S 0 d
我改變mdic.txt
到mdic.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.txt
到cm.gram
。
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"));
線得到這個錯誤。
masoud的正確轉錄是「M AH S UW D」 –