Menu

Pocketsphinx Android: Keywordsearch Optimizing

Help
2015-08-15
2015-08-15
  • Gerhard Reisinger

    Hello everybody :)

    I'm new to Pocketsphinx and i want to use multiple Keywordsearch to control my Android-App.
    I managed to compile the PocketsphinxAndroidDemo in AndroidStudio.
    The code of the original PocketsphinxAndroidDemo is here:
    https://github.com/cmusphinx/pocketsphinx-android-demo

    Then i adopted the downloadable demo-project to only have multiple Keywordsearch (this means, i removed the menu, the digits-option, the forecast-option, etc.).

    This is running fine, I adopted the Demo-App, to recognize multiple Keywords, for example the keyword "left" should later do something else than the keyword "right" or "exit".

    But the quality of the recognition is very bad:
    1) Most of the time, i have to speak a specific keyword 2-3 times, before it gets recognized.
    2) Detection only seems to be possible, if there's not much background noise. For example, if my TV is running in background (even if the volume is at a "normal" level), hardly any keywords are hit.

    Like I already told you, I'm new to Pocketsphinx and i dont have that much time to get an expert at speech recognition theory, but maybe someone has some quick tips for me to tweak and optimize my recognition results?
    I think one major thing would be to get the right KeywordTreshold; i tried to optimize these values, but it's not good enough.

    Here are my main code-parts ...

    My setupRecognizer-Method (which is holding the main-config-values like the KeywordThreshold):

    private void setupRecognizer(File assetsDir)
    {
    try {
    recognizer = defaultSetup().setAcousticModel(new File(assetsDir, "en-us-ptm"))
    .setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
    .setRawLogDir(assetsDir).setKeywordThreshold(1e-20f)
    .getRecognizer();

    } catch (IOException e) {
    e.printStackTrace();
    }

    recognizer.addListener(this);

    File digitsGrammar = new File(assetsDir, "digits.gram");
    recognizer.addKeywordSearch(DIGITS_SEARCH, digitsGrammar);
    }

    My digits.gram, each line for one keyword and the keywordspecific threshold between the slashes:
    left /1e-8/
    right /1e-4/
    enter /1e-8/
    back /1e-4/
    scan /1e-5/
    update /1e-2/
    info /1e-4/
    exit /1e-5/

    Did I miss some extra config values for Pocketphinx Android Version to get better results?
    Is it better to use "long" words (for example "congressperson" or "great-grandfather") or "short" words (for example "exit")?
    Could someone explain me, why the "KeywordTreshold" can be set at the initialization in java-code (.setKeywordThreshold) AND for every single keyword in the .gram-file?

    I'm using the latest version of Pocketphinx Android Demo (August 2015) and the latest version of Android Studio.
    My test-device is a Samsung Galaxy S3.
    If you need any further details, or if I missed something you need to know to help me with my little problem, please just ask!

    Thank you in advance for your help! :)

     
  • Nickolay V. Shmyrev

    Did I miss some extra config values for Pocketphinx Android Version to get better results?

    No

    Is it better to use "long" words (for example "congressperson" or "great-grandfather") or "short" words (for example "exit")?

    Documentation recommends to use keyword of 4-5 syllables.

    Could someone explain me, why the "KeywordTreshold" can be set at the initialization in java-code (.setKeywordThreshold) AND for every single keyword in the .gram-file?

    Java code threshold is default fallback if keyword line does not have a threshold or if keyword is set from a phrase, not with a file. In case you use keyword list file with per-keyword thresholds you do not need to set threshold from java code.

     

Log in to post a comment.