FS-5188 --resolve Allow full path to grammar in mod_pocketsphinx

This commit is contained in:
Christopher Rienzo 2013-03-15 19:53:13 -04:00
parent 424738e9c5
commit e917202d5e

View File

@ -125,7 +125,12 @@ static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, co
}
if (switch_is_file_path(grammar)) {
jsgf = switch_mprintf("%s.gram", grammar);
char *dot = strrchr(grammar, '.');
if (dot && !strcmp(dot, ".gram")) {
jsgf = strdup(grammar);
} else {
jsgf = switch_mprintf("%s.gram", grammar);
}
} else {
jsgf = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
}