提交 93da71f9 authored 作者: Brian West's avatar Brian West

add language weight to pocketsphinx

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13910 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 70f4d93c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<param name="silence-hits" value="25"/> <param name="silence-hits" value="25"/>
<param name="listen-hits" value="1"/> <param name="listen-hits" value="1"/>
<param name="auto-reload" value="true"/> <param name="auto-reload" value="true"/>
<!--<param name="language-weight" value="1"/>-->
<!--<param name="narrowband-model" value="communicator"/>--> <!--<param name="narrowband-model" value="communicator"/>-->
<!--<param name="wideband-model" value="wsj1"/>--> <!--<param name="wideband-model" value="wsj1"/>-->
<!--<param name="dictionary" value="default.dic"/>--> <!--<param name="dictionary" value="default.dic"/>-->
......
...@@ -46,6 +46,7 @@ static struct { ...@@ -46,6 +46,7 @@ static struct {
char *model8k; char *model8k;
char *model16k; char *model16k;
char *dictionary; char *dictionary;
char *language_weight;
uint32_t thresh; uint32_t thresh;
uint32_t silence_hits; uint32_t silence_hits;
uint32_t listen_hits; uint32_t listen_hits;
...@@ -160,6 +161,7 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co ...@@ -160,6 +161,7 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co
"-samprate", rate, "-samprate", rate,
"-hmm", model, "-hmm", model,
"-jsgf", jsgf, "-jsgf", jsgf,
"-lw", globals.language_weight,
"-dict", dic, "-dict", dic,
"-frate", "50", "-frate", "50",
"-silprob", "0.005", "-silprob", "0.005",
...@@ -433,6 +435,8 @@ static switch_status_t load_config(void) ...@@ -433,6 +435,8 @@ static switch_status_t load_config(void)
globals.thresh = atoi(val); globals.thresh = atoi(val);
} else if (!strcasecmp(var, "silence-hits")) { } else if (!strcasecmp(var, "silence-hits")) {
globals.silence_hits = atoi(val); 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")) { } else if (!strcasecmp(var, "listen-hits")) {
globals.listen_hits = atoi(val); globals.listen_hits = atoi(val);
} else if (!strcasecmp(var, "auto-reload")) { } else if (!strcasecmp(var, "auto-reload")) {
...@@ -459,6 +463,10 @@ static switch_status_t load_config(void) ...@@ -459,6 +463,10 @@ static switch_status_t load_config(void)
globals.dictionary = switch_core_strdup(globals.pool, "default.dic"); globals.dictionary = switch_core_strdup(globals.pool, "default.dic");
} }
if (!globals.language_weight) {
globals.language_weight = switch_core_strdup(globals.pool, "6.5");
}
done: done:
if (xml) { if (xml) {
switch_xml_free(xml); switch_xml_free(xml);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论