sumom****@users*****
sumom****@users*****
2008年 10月 17日 (金) 08:43:25 JST
Index: julius4/libsent/src/voca/voca_load_htkdict.c diff -u julius4/libsent/src/voca/voca_load_htkdict.c:1.5 julius4/libsent/src/voca/voca_load_htkdict.c:1.6 --- julius4/libsent/src/voca/voca_load_htkdict.c:1.5 Tue Sep 30 12:58:18 2008 +++ julius4/libsent/src/voca/voca_load_htkdict.c Fri Oct 17 08:43:25 2008 @@ -19,7 +19,7 @@ * @author Akinobu LEE * @date Fri Feb 18 19:43:06 2005 * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * */ /* @@ -645,6 +645,9 @@ int i; n = woffset; + while (n >= dstinfo->maxnum) { + if (winfo_expand(dstinfo) == FALSE) return FALSE; + } for(w=0;w<srcinfo->num;w++) { /* copy data */ dstinfo->wlen[n] = srcinfo->wlen[w]; @@ -662,12 +665,10 @@ if (n >= dstinfo->maxnum) { if (winfo_expand(dstinfo) == FALSE) return FALSE; } + } dstinfo->num = n; - /* compute maxwn */ - voca_set_stats(dstinfo); - - return TRUE; + return(voca_load_end(dstinfo)); } Index: julius4/libsent/src/voca/voca_load_wordlist.c diff -u julius4/libsent/src/voca/voca_load_wordlist.c:1.4 julius4/libsent/src/voca/voca_load_wordlist.c:1.5 --- julius4/libsent/src/voca/voca_load_wordlist.c:1.4 Tue Sep 30 12:58:18 2008 +++ julius4/libsent/src/voca/voca_load_wordlist.c Fri Oct 17 08:43:25 2008 @@ -13,7 +13,7 @@ * @author Akinobu LEE * @date Sun Jul 22 13:29:32 2007 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -127,7 +127,7 @@ return TRUE; } /** - * Top function to read word list via file pointer + * Top function to read word list via text * * @param fp [in] file pointer * @param winfo [out] pointer to word dictionary to store the read data. @@ -152,6 +152,33 @@ return(ret); } + +/** + * Top function to read word list via file pointer + * + * @param fp [in] file pointer + * @param winfo [out] pointer to word dictionary to store the read data. + * @param hmminfo [in] HTK %HMM definition data. if NULL, phonemes are ignored. + * @param headphone [in] word head silence model name + * @param tailphone [in] word tail silence model name + * @param contextphone [in] silence context name to be used at head and tail + * + * @return TRUE on success, FALSE on any error word. + */ +boolean +voca_load_wordlist_fp(FILE *fp, WORD_INFO *winfo, HTK_HMM_INFO *hmminfo, char *headphone, char *tailphone, char *contextphone) +{ + boolean ret; + + voca_load_start(winfo, hmminfo, FALSE); + while (getl_fp(buf, sizeof(buf), fp) != NULL) { + if (voca_load_word_line(buf, winfo, hmminfo, headphone, tailphone, contextphone) == FALSE) break; + } + ret = voca_load_end(winfo); + + return(ret); +} + /** * Sub function to Add a dictionary entry line to the word dictionary. * @@ -421,6 +448,7 @@ winfo->wseq[vnum] = (HMM_Logical **)mybmalloc2(sizeof(HMM_Logical *) * len, &(winfo->mroot)); memcpy(winfo->wseq[vnum], tmpwseq, sizeof(HMM_Logical *) * len); winfo->wlen[vnum] = len; + winfo->wton[vnum] = 0; } vnum++;