
switch language models in sphinx
By: a guest on
May 4th, 2012 | syntax:
C++ | size: 0.46 KB | hits: 17 | expires: Never
void switchModel(ps_decoder_t* ps, const char* modelFileName, const char* modelName)
{
cmd_ln_t *config = ps_get_config(ps);
logmath_t *logmath = ps_get_logmath(ps);
ngram_model_t *baseLanguageModel = ps_get_lmset(ps);
ngram_model_t *newLanguageModelToAdd = ngram_model_read(config, modelFileName, NGRAM_AUTO, logmath);
ngram_model_set_add(baseLanguageModel, newLanguageModelToAdd, modelName, 1.0, TRUE);
ngram_model_set_select(baseLanguageModel, modelName);
}