Menu

How to use custom language model and dic file on PocketSphinx Android Demo ?

Help
2016-06-15
2016-06-16
  • Vitaliy Adamchuk

    I downloaded Android PocketSphinx demo and opened source code on Android Studio.
    I confirmed demo project is working on my android device.
    Now i would like to set custom language model and dictionary file(.lm and .dic file).
    I have generated custom LM and Dic file using Sphinx Knowledge Base Tool.
    http://www.speech.cs.cmu.edu/tools/lmtool-new.html

    After i got LM and Dic file, i put these files to assets directory of source.

    And i changed code of existing PocketSphinxActivity.java class.
    Here are my code parts:
    https://www.dropbox.com/s/72hq74v3icon2p6/PocketSphinxActivity.java?dl=0

    But i can't recognize spoken words on custom language model.

    Please help me kindly.

    Thank you.

    Vitaliy

     
    • Nickolay V. Shmyrev

      It is a bad idea here to restart search on partial results:

      public void onPartialResult(Hypothesis hypothesis) {
          if (hypothesis == null)
              return;
      
          String text = hypothesis.getHypstr();
          ((TextView) findViewById(R.id.result_text)).setText(text);
          recognizer.stop();
          recognizer.startListening(CUSTOM_SEARCH,10000);
      }
      

      You should igore partial results probably and restart search only in onEndOfSpeech.

       
  • Vitaliy Adamchuk

    Here are LM and Dic file that created on Sphinx Knowledge Base Tool.

     
    • Vitaliy Adamchuk

      Dear Nickolay
      Thank you for your help.
      I removed the code in onPartialResult, so i can see speech recognition is working.
      But i observed new issue with Speech Recognition.
      When i don't say anything for a few minutes and then i try to say something, nothing is recognized.
      It's like the recognizer stops.
      Would you help me to fix this issue?
      Thank you.

       
      • Nickolay V. Shmyrev

        You can check in the logcat what actually happens. For example, if cmn shifts to smaller values. If you operate in noise, you might raise vad threshold to 3.0 to avoid processing of silence as speech.

         
  • misha mihail

    misha mihail - 2017-05-18

    Hello, Vitality Adamchuk, May i have a look your source code? I've same problem with you

     
  • misha mihail

    misha mihail - 2017-05-18

    It needs other dmp files?

     

Log in to post a comment.