Menu

PocketSphinx - language model switching

Help
Anonymous
2011-02-08
2012-09-22
  • Anonymous

    Anonymous - 2011-02-08

    I want to switch language dynamically and the tutorial is not clear.

    From http://cmusphinx.sourceforge.net/wiki/tuturialpocketsphinx, it says:


    Finally, language model switching is quite different. The decoder is always
    associated with a language model set object (yes, even if there is only one
    language model). Switching language models is accomplished by:

    1. Getting a handle to the language model set object: ps_get_lmset(ps_decoder_t *ps)
    2. Selecting the new language model: ngram_model_set_select()
    3. Telling the decoder the language model set has been updated: ps_update_lmset()

    My question is how to set up the language model set object (ps_decoder_t) in
    the first place so it can be passed to ps_get_lmset?

     
  • Nickolay V. Shmyrev

    My question is how to set up the language model set object (ps_decoder_t) in
    the first place so it can be passed to ps_get_lmset?

    You don't need to setup anything. Lmset is a part of the decoder and it's
    still used by it. You just get a pointer on lmset which you can modify. After
    lmset is updated decoder is updated automatically.

    For example of using lmset_update see test/unit/test_lm_read.c

     
  • Anonymous

    Anonymous - 2011-02-08

    Thanks for the reply.

    I think my question should be "How to load multiple languages at once?". In
    the tutorial it is loaded like this:

    config = cmd_ln_init(NULL, ps_args(), TRUE,
    "-hmm", MODELDIR "/hmm/en_US/hub4wsj_sc_8k",
    "-lm", MODELDIR "/lm/en/turtle.DMP",
    "-dict", MODELDIR "/lm/en/turtle.dic",
    NULL);

    In my case, I am using the PocketSphinxAndroidDemo project and the language
    model is loaded in RecognizerTask.java like this:

    Config c = new Config();
    /
    In 2.2 and above we can use getExternalFilesDir() or whatever it's
    called
    /
    c.setString("-hmm",
    "/sdcard/Android/data/edu.cmu.pocketsphinx/hmm/en_US/hub4wsj_sc_8k");
    c.setString("-dict",
    "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.dic");
    c.setString("-lm",
    "/sdcard/Android/data/edu.cmu.pocketsphinx/lm/en_US/hub4.5000.DMP");

    I am thinking creating a new Config object to load language model every time a
    different language is selected, so it doesn't have to load all the models at
    once. Loading all models at once seems bad.

     

Log in to post a comment.