From 93da71f96384107356db72d8a34fc45d488d7fb2 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 23 Jun 2009 17:28:00 +0000 Subject: [PATCH] add language weight to pocketsphinx git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13910 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- conf/autoload_configs/pocketsphinx.conf.xml | 1 + src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/conf/autoload_configs/pocketsphinx.conf.xml b/conf/autoload_configs/pocketsphinx.conf.xml index f6d8b6db5b..3bf7d5e575 100644 --- a/conf/autoload_configs/pocketsphinx.conf.xml +++ b/conf/autoload_configs/pocketsphinx.conf.xml @@ -4,6 +4,7 @@ + diff --git a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c index 94cd6db7e7..2c2ba6a5c3 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +++ b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c @@ -46,6 +46,7 @@ static struct { char *model8k; char *model16k; char *dictionary; + char *language_weight; uint32_t thresh; uint32_t silence_hits; uint32_t listen_hits; @@ -160,6 +161,7 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co "-samprate", rate, "-hmm", model, "-jsgf", jsgf, + "-lw", globals.language_weight, "-dict", dic, "-frate", "50", "-silprob", "0.005", @@ -433,6 +435,8 @@ static switch_status_t load_config(void) globals.thresh = atoi(val); } else if (!strcasecmp(var, "silence-hits")) { globals.silence_hits = atoi(val); + } else if (!strcasecmp(var, "language-weight")) { + globals.language_weight = switch_core_strdup(globals.pool, val); } else if (!strcasecmp(var, "listen-hits")) { globals.listen_hits = atoi(val); } else if (!strcasecmp(var, "auto-reload")) { @@ -459,6 +463,10 @@ static switch_status_t load_config(void) globals.dictionary = switch_core_strdup(globals.pool, "default.dic"); } + if (!globals.language_weight) { + globals.language_weight = switch_core_strdup(globals.pool, "6.5"); + } + done: if (xml) { switch_xml_free(xml);