[Freeswitch-svn] [commit] r13747 - freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx

FreeSWITCH SVN brian at freeswitch.org
Wed Jun 10 07:51:16 PDT 2009


Author: brian
Date: Wed Jun 10 09:51:15 2009
New Revision: 13747

Log:
 ok now you can specify the dictionary to use in the config file 

Modified:
   freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c

Modified: freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	Wed Jun 10 09:51:15 2009
@@ -45,6 +45,7 @@
 static struct {
 	char *model8k;
 	char *model16k;
+	char *dictionary;
 	uint32_t thresh;
 	uint32_t silence_hits;
 	uint32_t listen_hits;
@@ -134,7 +135,7 @@
 		model = switch_mprintf("%s%smodel%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, globals.model16k);
 	}
 
-	dic = switch_mprintf("%s%sdefault.dic", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR);
+	dic = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, globals.dictionary);
 
 	if (switch_file_exists(dic, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary %s.\n", dic); 
@@ -443,6 +444,8 @@
 				globals.model8k = switch_core_strdup(globals.pool, val);
 			} else if (!strcasecmp(var, "wideband-model")) {
 				globals.model16k = switch_core_strdup(globals.pool, val);
+			} else if (!strcasecmp(var, "dictionary")) {
+				globals.dictionary = switch_core_strdup(globals.pool, val);
 			}
 		}
 	}
@@ -455,6 +458,10 @@
 		globals.model16k = switch_core_strdup(globals.pool, "wsj1");
 	}
 
+	if (!globals.dictionary) {
+		globals.dictionary = switch_core_strdup(globals.pool, "default.dic");
+	}
+
  done:
 	if (xml) {
 		switch_xml_free(xml);



More information about the Freeswitch-svn mailing list