メインページ | モジュール | データ構造 | Directories | ファイル一覧 | データフィールド | グローバル | 関連ページ

mkcpair.c

説明を見る。
00001 
00043 /*
00044  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00045  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00046  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology, Nagoya Institute of Technology
00047  * All rights reserved
00048  */
00049 
00050 #include <sent/stddefs.h>
00051 #include <sent/dfa.h>
00052 
00059 void
00060 extract_cpair(DFA_INFO *dinfo)
00061 {
00062   int i;
00063   DFA_ARC *arc_l, *arc_r, *arc_r2;
00064   int left, right;
00065 
00066   /* initialize */
00067   malloc_dfa_cp(dinfo, dinfo->term_num);
00068 
00069   /* extract cpair info */
00070   for (i=0;i<dinfo->state_num;i++) {
00071     if ((dinfo->st[i].status & INITIAL_S) != 0) { /* arc from initial state */
00072       for (arc_r = dinfo->st[i].arc; arc_r; arc_r = arc_r->next) {
00073         if (dinfo->is_sp[arc_r->label]) {
00074           j_error("Error: skippable sp should not appear at end of sentence\n");
00075         }
00076         set_dfa_cp_end(dinfo, arc_r->label, TRUE);
00077       }
00078     }
00079     for(arc_l = dinfo->st[i].arc; arc_l; arc_l = arc_l->next) {
00080       left = arc_l->label;
00081       if ((dinfo->st[arc_l->to_state].status & ACCEPT_S) != 0) {/* arc to accept state */
00082         if (dinfo->is_sp[left]) {
00083           j_error("Error: skippable sp should not appear at beginning of sentence\n");
00084         }
00085         set_dfa_cp_begin(dinfo, left, TRUE);
00086       }
00087       /* others */
00088       for (arc_r = dinfo->st[arc_l->to_state].arc; arc_r; arc_r = arc_r->next) {
00089         right = arc_r->label;
00090         set_dfa_cp(dinfo, right, left, TRUE);
00091         if (dinfo->is_sp[right]) {
00092           for (arc_r2 = dinfo->st[arc_r->to_state].arc; arc_r2; arc_r2 = arc_r2->next) {
00093             if (dinfo->is_sp[arc_r2->label]) { /* sp model continues twice */
00094               j_error("Error: skippable sp should not repeat\n");
00095             }
00096             set_dfa_cp(dinfo, arc_r2->label, left, TRUE);
00097           }
00098         }
00099       }
00100 
00101     }
00102   }
00103 }
00104 
00112 void
00113 cpair_append(DFA_INFO *dst, DFA_INFO *src, int coffset)
00114 {
00115   int i,j;
00116 
00117   /* dst info must be already appended */
00118   /* [coffset..dst->term_num-1] is the new categories */
00119   if (dst->term_num - coffset != src->term_num) {
00120     j_error("InternalError: append term num not match!: %d, %d, %d\n",
00121             dst->term_num, src->term_num, coffset);
00122   }
00123 
00124   /* allocate appended area */
00125   realloc_dfa_cp(dst, coffset, dst->term_num);
00126   
00127   /* append cp */
00128   for(i=coffset;i<dst->term_num;i++) {
00129     for(j=coffset;j<dst->term_num;j++) {
00130       set_dfa_cp(dst, i, j, dfa_cp(src, i-coffset, j-coffset));
00131     }
00132     set_dfa_cp_begin(dst, i, dfa_cp_begin(src, i-coffset));
00133     set_dfa_cp_end(dst, i, dfa_cp_end(src, i-coffset));
00134   }
00135 }

Juliusに対してTue Mar 28 16:20:50 2006に生成されました。  doxygen 1.4.2