Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00042 #ifndef __PS_LATTICE_INTERNAL_H__
00043 #define __PS_LATTICE_INTERNAL_H__
00044
00053 typedef struct latlink_list_s {
00054 ps_latlink_t *link;
00055 struct latlink_list_s *next;
00056 } latlink_list_t;
00057
00061 struct ps_lattice_s {
00062 int refcount;
00064 ps_search_t *search;
00065 logmath_t *lmath;
00067 ps_latnode_t *nodes;
00068 ps_latnode_t *start;
00069 ps_latnode_t *end;
00071 int32 n_frames;
00072 int32 final_node_ascr;
00073 int32 norm;
00074 char *hyp_str;
00076 listelem_alloc_t *latnode_alloc;
00077 listelem_alloc_t *latlink_alloc;
00078 listelem_alloc_t *latlink_list_alloc;
00080
00081 latlink_list_t *q_head;
00082 latlink_list_t *q_tail;
00083 };
00084
00092 struct ps_latlink_s {
00093 struct ps_latnode_s *from;
00094 struct ps_latnode_s *to;
00095 struct ps_latlink_s *best_prev;
00096 int32 ascr;
00097 int32 path_scr;
00098 int32 ef;
00099 int32 alpha;
00100 int32 beta;
00101 };
00102
00109 struct ps_latnode_s {
00110 int32 id;
00111 int32 wid;
00112 int32 basewid;
00113
00114 int32 fef;
00115 int32 lef;
00116 int16 sf;
00117 int16 reachable;
00118 union {
00119 glist_t velist;
00120 int32 fanin;
00121 int32 rem_score;
00122 int32 best_exit;
00123 } info;
00124 latlink_list_t *exits;
00125 latlink_list_t *entries;
00127 struct ps_latnode_s *alt;
00128 struct ps_latnode_s *next;
00129 };
00130
00134 typedef struct dag_seg_s {
00135 ps_seg_t base;
00136 ps_latlink_t **links;
00137 int32 norm;
00138 int16 n_links;
00139 int16 cur;
00140 } dag_seg_t;
00141
00148 typedef struct ps_latpath_s {
00149 ps_latnode_t *node;
00150 struct ps_latpath_s *parent;
00151 struct ps_latpath_s *next;
00152 int32 score;
00153 } ps_latpath_t;
00154
00158 typedef struct ps_astar_s {
00159 ps_lattice_t *dag;
00160 ngram_model_t *lmset;
00161 float32 lwf;
00162
00163 int16 sf;
00164 int16 ef;
00165 int32 w1;
00166 int32 w2;
00167
00168 int32 n_hyp_tried;
00169 int32 n_hyp_insert;
00170 int32 n_hyp_reject;
00171 int32 insert_depth;
00172 int32 n_path;
00173
00174 ps_latpath_t *path_list;
00175 ps_latpath_t *path_tail;
00176 ps_latpath_t *top;
00177
00178 glist_t hyps;
00179 listelem_alloc_t *latpath_alloc;
00180 } ps_astar_t;
00181
00185 typedef struct astar_seg_s {
00186 ps_seg_t base;
00187 ps_latnode_t **nodes;
00188 int n_nodes;
00189 int cur;
00190 } astar_seg_t;
00191
00195 ps_lattice_t *ps_lattice_init_search(ps_search_t *search, int n_frame);
00196
00200 void ps_lattice_bypass_fillers(ps_lattice_t *dag, int32 silpen, int32 fillpen);
00201
00205 void ps_lattice_delete_unreachable(ps_lattice_t *dag);
00206
00210 void ps_lattice_pushq(ps_lattice_t *dag, ps_latlink_t *link);
00211
00215 ps_latlink_t *ps_lattice_popq(ps_lattice_t *dag);
00216
00220 void ps_lattice_delq(ps_lattice_t *dag);
00221
00225 latlink_list_t *latlink_list_new(ps_lattice_t *dag, ps_latlink_t *link,
00226 latlink_list_t *next);
00227
00231 char const *ps_lattice_hyp(ps_lattice_t *dag, ps_latlink_t *link);
00232
00236 ps_seg_t *ps_lattice_seg_iter(ps_lattice_t *dag, ps_latlink_t *link,
00237 float32 lwf);
00238
00248 ps_astar_t *ps_astar_start(ps_lattice_t *dag,
00249 ngram_model_t *lmset,
00250 float32 lwf,
00251 int sf, int ef,
00252 int w1, int w2);
00253
00259 ps_latpath_t *ps_astar_next(ps_astar_t *nbest);
00260
00264 void ps_astar_finish(ps_astar_t *nbest);
00265
00269 char const *ps_astar_hyp(ps_astar_t *nbest, ps_latpath_t *path);
00270
00274 ps_seg_t *ps_astar_seg_iter(ps_astar_t *astar, ps_latpath_t *path, float32 lwf);
00275
00276
00277 #endif