From sumomo @ users.sourceforge.jp Tue Oct 11 15:51:07 2011 From: sumomo @ users.sourceforge.jp (sumomo @ users.sourceforge.jp) Date: Tue, 11 Oct 2011 15:51:07 +0900 Subject: [Julius-cvs 707] CVS update: julius4/libjulius/src Message-ID: <1318315867.447369.13672.nullmailer@users.sourceforge.jp> Index: julius4/libjulius/src/beam.c diff -u julius4/libjulius/src/beam.c:1.18 julius4/libjulius/src/beam.c:1.19 --- julius4/libjulius/src/beam.c:1.18 Thu Jul 28 16:11:35 2011 +++ julius4/libjulius/src/beam.c Tue Oct 11 15:51:06 2011 @@ -42,7 +42,7 @@ * @author Akinobu LEE * @date Tue Feb 22 17:00:45 2005 * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * */ /* @@ -1708,6 +1708,10 @@ new->last_lscore = 0.0; #else new->last_lscore = d->penalty1; +#ifdef CLASS_NGRAM + /* add per-word penalty */ + new->last_lscore += wchmm->winfo->cprob[i]; +#endif #endif if (wchmm->hmminfo->multipath) { new->score = new->last_lscore; @@ -2393,6 +2397,10 @@ /* grammar: 単語挿入ペナルティを追加 */ /* grammar: add insertion penalty */ ngram_score_cache = d->penalty1; +#ifdef CLASS_NGRAM + /* add per-word penalty of last word as delayed penalty */ + ngram_score_cache += wchmm->winfo->cprob[last_word]; +#endif tmpsum += ngram_score_cache; /* grammar: deterministic factoring (in case category-tree not enabled) */ Index: julius4/libjulius/src/dfa_decode.c diff -u julius4/libjulius/src/dfa_decode.c:1.4 julius4/libjulius/src/dfa_decode.c:1.5 --- julius4/libjulius/src/dfa_decode.c:1.4 Fri Apr 29 14:09:15 2011 +++ julius4/libjulius/src/dfa_decode.c Tue Oct 11 15:51:06 2011 @@ -47,7 +47,7 @@ * @author Akinobu LEE * @date Mon Mar 7 15:31:00 2005 * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * */ /* @@ -115,6 +115,10 @@ nw[num]->lscore = 0.0; #else nw[num]->lscore = r->config->lmp.penalty2; +#ifdef CLASS_NGRAM + /* add per-word penalty */ + nw[num]->lscore += r->wchmm->winfo->cprob[nw[num]->id]; +#endif #endif num++; if (num >= maxnw) return -1; /* buffer overflow */ @@ -179,6 +183,10 @@ nw[num]->next_state = ns2; nw[num]->can_insert_sp = TRUE; nw[num]->lscore = r->config->lmp.penalty2; +#ifdef CLASS_NGRAM + /* add per-word penalty */ + nw[num]->lscore += r->wchmm->winfo->cprob[nw[num]->id]; +#endif num++; if (num >= maxnw) return -1; /* buffer overflow */ } @@ -189,8 +197,11 @@ nw[num]->id = dfa->term.tw[cate][iw]; nw[num]->next_state = ns; nw[num]->can_insert_sp = FALSE; - nw[num]->lscore = r->config->lmp.penalty2; +#ifdef CLASS_NGRAM + /* add per-word penalty */ + nw[num]->lscore += r->wchmm->winfo->cprob[nw[num]->id]; +#endif num++; if (num >= maxnw) return -1; /* buffer overflow */ }