[Julius-cvs 329] CVS update: julius4/julius

Back to archive index

sumom****@users***** sumom****@users*****
2008年 10月 17日 (金) 08:43:25 JST


Index: julius4/julius/module.c
diff -u julius4/julius/module.c:1.7 julius4/julius/module.c:1.8
--- julius4/julius/module.c:1.7	Sun Oct 12 08:11:50 2008
+++ julius4/julius/module.c	Fri Oct 17 08:43:25 2008
@@ -88,23 +88,30 @@
  * </EN>
  */
 static boolean
-read_grammar(FILE *fp, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo, boolean lmvar)
+read_grammar(FILE *fp, DFA_INFO **ret_dfa, WORD_INFO **ret_winfo, HTK_HMM_INFO *hmminfo, RecogProcess *r)
 {
   DFA_INFO *dfa = NULL;
   WORD_INFO *winfo;
+  JCONF_LM *lmconf;
 
   /* load grammar: dfa and dict in turn */
-  if (lmvar != LM_DFA_WORD) {
+  if (r->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)) {
-    if (dfa) dfa_info_free(dfa);
-    return FALSE;
+  if (r->lmvar == LM_DFA_WORD) {
+    lmconf = r->lm->config;
+    if (!voca_load_wordlist_fp(fp, winfo, hmminfo, lmconf->wordrecog_head_silence_model_name, lmconf->wordrecog_tail_silence_model_name, (lmconf->wordrecog_silence_context_name[0] == '\0') ? NULL : lmconf->wordrecog_silence_context_name)) {
+      return FALSE;
+    }
+  } else {
+    if (!voca_load_htkdict_fp(fp, winfo, hmminfo, FALSE)) {
+      dfa_info_free(dfa);
+      return FALSE;
+    }
   }
   *ret_dfa = dfa;
   *ret_winfo = winfo;
@@ -248,7 +255,7 @@
       p = NULL;
     }
     /* read a new grammar via socket */
-    if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur->lmvar) == FALSE) {
+    if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur) == FALSE) {
       module_send(module_sd, "<GRAMMAR STATUS=\"ERROR\" REASON=\"WRONG DATA\"/>\n.\n");
     } else {
       if (cur->lmtype == LM_DFA) {
@@ -282,7 +289,7 @@
       p = NULL;
     }
     /* read a new grammar via socket */
-    if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur->lmvar) == FALSE) {
+    if (read_grammar(module_fp, &new_dfa, &new_winfo, cur->am->hmminfo, cur) == 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.3 julius4/julius/output_module.c:1.4
--- julius4/julius/output_module.c:1.3	Sun Oct 12 08:11:50 2008
+++ julius4/julius/output_module.c	Fri Oct 17 08:43:25 2008
@@ -12,7 +12,7 @@
  * @author Akinobu Lee
  * @date   Tue Sep 06 14:46:49 2005
  *
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
  * 
  */
 /*
@@ -657,6 +657,10 @@
 {
   MULTIGRAM *m;
 
+  if (r->lmtype == LM_PROB) {
+    module_send(module_sd, "<GRAMMAR STATUS=\"ERROR\" REASON=\"NOT A GRAMMAR-BASED LM\"/>\n.\n");
+    return;
+  }
   module_send(module_sd, "<GRAMINFO>\n");
   for(m=r->lm->grammars;m;m=m->next) {
     module_send(module_sd, "  #%2d: [%-11s] %4d words",


Julius-cvs メーリングリストの案内
Back to archive index