]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweaks
authorBrian West <brian@freeswitch.org>
Wed, 9 Jul 2008 13:50:58 +0000 (13:50 +0000)
committerBrian West <brian@freeswitch.org>
Wed, 9 Jul 2008 13:50:58 +0000 (13:50 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8954 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c

index da7b955fc1517ccd3007bc538a41f0991ca4fa42..eb28a531669bb61284a9c08925172c25c314f6a6 100644 (file)
@@ -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 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co
 
        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 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_pocketsphinx_load)
        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;
 }