[Julius-cvs 804] CVS update: julius4/libsent/src/voca

アーカイブの一覧に戻る

sumom****@users***** sumom****@users*****
2013年 6月 12日 (水) 18:48:26 JST


Index: julius4/libsent/src/voca/voca_load_htkdict.c
diff -u julius4/libsent/src/voca/voca_load_htkdict.c:1.12 julius4/libsent/src/voca/voca_load_htkdict.c:1.13
--- julius4/libsent/src/voca/voca_load_htkdict.c:1.12	Fri Jul 27 17:44:57 2012
+++ julius4/libsent/src/voca/voca_load_htkdict.c	Wed Jun 12 18:48:26 2013
@@ -19,7 +19,7 @@
  * @author Akinobu LEE
  * @date   Fri Feb 18 19:43:06 2005
  *
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
  * 
  */
 /*
@@ -489,6 +489,59 @@
     return TRUE;
   }
   winfo->woutput[vnum] = strcpy((char *)mybmalloc2(strlen(ptmp)+1, &(winfo->mroot)), ptmp);
+
+#ifdef USE_MBR
+
+  /**
+   *
+   * Update 7 March 2011
+   *
+   * MBR Expansion Hiroaki NANJO
+   *               Ryo FURUTANI
+   *
+   **/
+
+  /* just move pointer to next token */
+  if ((ptmp = mystrtok_movetonext(NULL, " \t\n")) == NULL) {
+    jlog("Error: voca_load_htkdict: line %d: corrupted data:\n> %s\n", linenum, bufbak);
+    winfo->errnum++;
+    *ok_flag = FALSE;
+    return TRUE;
+  }
+
+  if (ptmp[0] == ':') {        /* Word weight (use minimization WWER on MBR) */
+
+    /* Word weight (use minimization WWER on MBR) */
+    /* format: (classname @classprob) wordname [output] :weight phoneseq */
+    /* format: :%f (linear scale) */
+    /* if ":" not found, it means weight == 1.0 (same minimization WER) */
+
+    if ((ptmp = mystrtok(NULL, " \t\n")) == NULL) {
+      jlog("Error: voca_load_htkdict: line %d: corrupted data:\n> %s\n", linenum, bufbak);
+      winfo->errnum++;
+      *ok_flag = FALSE;
+      return TRUE;
+    }
+    if (ptmp[1] == '\0') {     /* space between ':' and figures */
+      jlog("Error: voca_load_htkdict: line %d: value after ':' missing, maybe wrong space?\n> %s\n", linenum, bufbak);
+      winfo->errnum++;
+      *ok_flag = FALSE;
+      return TRUE;
+    }
+    winfo->weight[vnum] = atof(&(ptmp[1]));
+  }
+  else{
+    winfo->weight[vnum] = 1.0; /* default, same minimization WER */
+  }
+
+  /**
+   *
+   * MBR Expansion End
+   *
+   **/
+
+#endif
+
     
   /* phoneme sequence */
   if (hmminfo == NULL) {
Index: julius4/libsent/src/voca/voca_load_wordlist.c
diff -u julius4/libsent/src/voca/voca_load_wordlist.c:1.8 julius4/libsent/src/voca/voca_load_wordlist.c:1.9
--- julius4/libsent/src/voca/voca_load_wordlist.c:1.8	Fri Jul 27 17:44:57 2012
+++ julius4/libsent/src/voca/voca_load_wordlist.c	Wed Jun 12 18:48:26 2013
@@ -13,7 +13,7 @@
  * @author Akinobu LEE
  * @date   Sun Jul 22 13:29:32 2007
  *
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
  * 
  */
 /*
@@ -306,6 +306,59 @@
     return TRUE;
   }
   winfo->woutput[vnum] = strcpy((char *)mybmalloc2(strlen(ptmp)+1, &(winfo->mroot)), ptmp);
+
+#ifdef USE_MBR
+
+  /**
+   *
+   * Update 7 March 2011
+   *
+   * MBR Expansion Hiroaki NANJO
+   *               Ryo FURUTANI
+   *
+   **/
+
+  /* just move pointer to next token */
+  if ((ptmp = mystrtok_movetonext(NULL, " \t\n")) == NULL) {
+    jlog("Error: voca_load_htkdict: line %d: corrupted data:\n> %s\n", linenum, bufbak);
+    winfo->errnum++;
+    *ok_flag = FALSE;
+    return TRUE;
+  }
+
+  if (ptmp[0] == ':') {        /* Word weight (use minimization WWER on MBR) */
+
+    /* Word weight (use minimization WWER on MBR) */
+    /* format: (classname @classprob) wordname [output] :weight phoneseq */
+    /* format: :%f (linear scale) */
+    /* if ":" not found, it means weight == 1.0 (same minimization WER) */
+
+    if ((ptmp = mystrtok(NULL, " \t\n")) == NULL) {
+      jlog("Error: voca_load_htkdict: line %d: corrupted data:\n> %s\n", linenum, bufbak);
+      winfo->errnum++;
+      *ok_flag = FALSE;
+      return TRUE;
+    }
+    if (ptmp[1] == '\0') {     /* space between ':' and figures */
+      jlog("Error: voca_load_htkdict: line %d: value after ':' missing, maybe wrong space?\n> %s\n", linenum, bufbak);
+      winfo->errnum++;
+      *ok_flag = FALSE;
+      return TRUE;
+    }
+    winfo->weight[vnum] = atof(&(ptmp[1]));
+  }
+  else{
+    winfo->weight[vnum] = 1.0; /* default, same minimization WER */
+  }
+
+  /**
+   *
+   * MBR Expansion End
+   *
+   **/
+
+#endif
+
     
   /* phoneme sequence */
   if (hmminfo == NULL) {
Index: julius4/libsent/src/voca/voca_malloc.c
diff -u julius4/libsent/src/voca/voca_malloc.c:1.7 julius4/libsent/src/voca/voca_malloc.c:1.8
--- julius4/libsent/src/voca/voca_malloc.c:1.7	Fri Jul 27 17:44:57 2012
+++ julius4/libsent/src/voca/voca_malloc.c	Wed Jun 12 18:48:26 2013
@@ -12,7 +12,7 @@
  * @author Akinobu LEE
  * @date   Fri Feb 18 21:33:29 2005
  *
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
  * 
  */
 /*
@@ -48,6 +48,9 @@
   new->cprob = NULL;
 #endif
   new->is_transparent = NULL;
+#ifdef USE_MBR
+  new->weight = NULL;
+#endif
 
   return(new);
 }
@@ -72,6 +75,26 @@
 #endif
   if (winfo->is_transparent != NULL) free(winfo->is_transparent);
   /* free whole */
+#ifdef USE_MBR
+
+  /**
+   *
+   * Update 4 March 2011
+   *
+   * MBR Expansion Hiroaki NANJO
+   *               Ryo FURUTANI
+   *
+   **/
+
+  if (winfo->weight != NULL) free(winfo->weight);
+
+  /**
+   *
+   * MBR Expansion End
+   *
+   **/
+
+#endif
   free(winfo);
 }
 
@@ -103,6 +126,28 @@
   winfo->maxwlen = 0;
   winfo->errnum = 0;
   winfo->errph_root = NULL;
+
+#ifdef USE_MBR
+
+  /**
+   *
+   * Update 4 March 2011
+   *
+   * MBR Expansion Hiroaki NANJO
+   *               Ryo FURUTANI
+   *
+   **/
+
+  winfo->weight = (LOGPROB *)mymalloc(sizeof(LOGPROB)*n);
+
+  /**
+   *
+   * MBR Expansion End
+   *
+   **/
+
+#endif
+
 }
 
 /** 
@@ -132,6 +177,26 @@
   winfo->cprob = (LOGPROB *)myrealloc(winfo->cprob, sizeof(LOGPROB)*n);
 #endif
   winfo->is_transparent = (boolean *)myrealloc(winfo->is_transparent, sizeof(boolean)*n);
+
+#ifdef USE_MBR
+  /**
+   *
+   * Update 4 March 2011
+   *
+   * MBR Expansion Hiroaki NANJO
+   *               Ryo FURUTANI
+   *
+   **/
+
+  winfo->weight = (LOGPROB *)myrealloc(winfo->weight, sizeof(LOGPROB)*n);
+
+  /**
+   *
+   * MBR Expansion End
+   *
+   **/
+#endif
+
   winfo->maxnum = n;
 
   return TRUE;



Julius-cvs メーリングリストの案内
アーカイブの一覧に戻る