androidpythonpocketsphinxpocketsphinx-android

Phone 'MA' is mising in the acoustic model; word 'masoud' - pocketsphinx


my name is masoud. now I want to when I say masoud, my app print a console log.

to do this I made a mdic.txt file and I put my name inside it :

masoud MA S O D

I changed mdic.txt to mdic.dict and put it at assets/sync direcotry .

I made a cm.txt file and I put a string inside it:

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

and I changed cm.txt to cm.gram .

in my 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"));

now I got this message:

"dict.c", line 195: Line 1: Phone 'MA' is mising in the acoustic model; word 'masoud' ignored "kws_search.c", line 171: The word 'masoud' is missing in the dictionary

I got this error at recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir, "mdic.dict")); line .


Solution

  • The correct transcription for masoud is "M AH S UW D".

    There is no phone MA in acoustic model. The error says about that.