sumom****@users*****
sumom****@users*****
2008年 10月 12日 (日) 08:11:50 JST
Index: julius4/julius/module.c diff -u julius4/julius/module.c:1.6 julius4/julius/module.c:1.7 --- julius4/julius/module.c:1.6 Thu Sep 25 13:56:20 2008 +++ julius4/julius/module.c Sun Oct 12 08:11:50 2008 @@ -88,20 +88,22 @@ * </EN> */ static boolean -read_grammar(FILE *fp, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo) +read_grammar(FILE *fp, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo, boolean lmvar) { - DFA_INFO *dfa; + DFA_INFO *dfa = NULL; WORD_INFO *winfo; /* load grammar: dfa and dict in turn */ - dfa = dfa_info_new(); - if (!rddfa_fp(fp, dfa)) { - return FALSE; + if (lmvar != LM_DFA_WORD) { + dfa = dfa_info_new(); + if (!rddfa_fp(fp, dfa)) { + return FALSE; + } } winfo = word_info_new(); /* ignore MONOTREE */ if (!voca_load_htkdict_fp(fp, winfo, hmminfo, FALSE)) { - dfa_info_free(dfa); + if (dfa) dfa_info_free(dfa); return FALSE; } *ret_dfa = dfa; @@ -246,7 +248,7 @@ p = NULL; } /* read a new grammar via socket */ - if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { + if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur->lmvar) == FALSE) { module_send(module_sd, "<GRAMMAR STATUS=\"ERROR\" REASON=\"WRONG DATA\"/>\n.\n"); } else { if (cur->lmtype == LM_DFA) { @@ -280,7 +282,7 @@ p = NULL; } /* read a new grammar via socket */ - if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo) == FALSE) { + if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur->lmvar) == FALSE) { module_send(module_sd, "<GRAMMAR STATUS=\"ERROR\" REASON=\"WRONG DATA\"/>\n.\n"); } else { if (cur->lmtype == LM_DFA) { Index: julius4/julius/output_module.c diff -u julius4/julius/output_module.c:1.2 julius4/julius/output_module.c:1.3 --- julius4/julius/output_module.c:1.2 Tue Dec 18 17:45:48 2007 +++ julius4/julius/output_module.c Sun Oct 12 08:11:50 2008 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Tue Sep 06 14:46:49 2005 * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * */ /* @@ -659,10 +659,14 @@ module_send(module_sd, "<GRAMINFO>\n"); for(m=r->lm->grammars;m;m=m->next) { - module_send(module_sd, " #%2d: [%-11s] %4d words, %3d categories, %4d nodes", + module_send(module_sd, " #%2d: [%-11s] %4d words", m->id, m->active ? "active" : "inactive", - m->winfo->num, m->dfa->term_num, m->dfa->state_num); + m->winfo->num); + if (m->dfa) { + module_send(module_sd, ", %3d categories, %4d nodes", + m->dfa->term_num, m->dfa->state_num); + } if (m->newbie) module_send(module_sd, " (new)"); if (m->hook != MULTIGRAM_DEFAULT) { module_send(module_sd, " (next: %s)", hookstr[m->hook]);