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

Freeswitch SVN brian at freeswitch.org
Wed Jul 9 09:50:59 EDT 2008


Author: brian
Date: Wed Jul  9 09:50:58 2008
New Revision: 8954

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

Log:
tweaks

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 Jul  9 09:50:58 2008
@@ -32,6 +32,7 @@
 
 #include <switch.h>
 #include <pocketsphinx.h>
+#include <sphinxbase/err.h>
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_pocketsphinx_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_pocketsphinx_shutdown);
@@ -113,6 +114,16 @@
 
 	model = switch_mprintf("%s%smodel%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, globals.model);
 
+	if (switch_file_exists(dic, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary.\n"); 
+		goto end;
+	}
+
+	if (switch_file_exists(lm, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open language model.\n"); 
+		goto end;
+	}
+
 	switch_assert(lm && dic && model);
 	
 	ps->config = cmd_ln_init(ps->config, ps_args(), FALSE,
@@ -380,7 +391,8 @@
 	asr_interface->asr_get_results = pocketsphinx_asr_get_results;
 
 	globals.model = switch_core_strdup(pool, "communicator");
-	
+	err_set_logfp(NULL);
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }



More information about the Freeswitch-svn mailing list