53 #if defined(INSTANTIATE_TEMPLATES) 55 #include "../base_class/EST_TVector.cc" 86 inline bool null_lpf(
const int,
const int,
const int,
const int)
111 static float fixed_ins;
112 static float fixed_del;
113 static float fixed_sub;
124 if (s1->
name() == null_sym)
126 else if (s2->
name() == null_sym)
137 float ins,
float del,
float sub)
173 l1 = lexical.
length() + 1;
174 l2 = surface.
length() + 1;
183 for (p=lexical.
head(),i=1; p != 0; p = p->
next(),i++)
185 for (p=surface.
head(),i=1; p != 0; p = p->
next(),i++)
216 lcf,lpf,null_sym,cost))
218 cerr <<
"No path found (over pruning ?)" << endl;
223 for (p = lexical.
head(); p; p = p->
next())
263 int best_i=-1,best_j=-1;
282 best_c = lcf(null_sym,null_sym);
290 lcf,lpf, null_sym,cost))
294 best_c = lcf(null_sym,vr2(j)) + cost.
a(i,j-1);
307 lcf,lpf, null_sym,cost))
311 best_c = lcf(vr1(i),null_sym) + cost.
a(i-1,j);
322 if(
dp_sub(i-1,j-1,vr1,vr2,
324 lcf,lpf, null_sym,cost))
326 sub = 2 * lcf(vr1(i),vr2(j)) + cost(i-1,j-1);
337 lcf,lpf, null_sym,cost))
339 ins=lcf(null_sym,vr2(j)) + cost(i,j-1);
350 lcf,lpf, null_sym,cost))
352 del=lcf(vr1(i),null_sym) + cost(i-1,j);
362 cost.
a(i,j) = best_c;
401 if ((p1 == 0) || (p2 == 0)) {
402 cerr <<
"trace back and link: Wrong dynamic programming " <<
403 "path or wrong items at (i=" << i <<
", j=" << j <<
")" <<
415 cerr <<
"trace back and link: Wrong dynamic programming " <<
416 "path or wrong item p1 at (i=" << i <<
", j=" << j <<
")" <<
428 cerr <<
"trace back and link: Wrong dynamic programming " <<
429 "path or wrong item p2 at (i=" << i <<
", j=" << j <<
")" <<
const EST_String name() const
float(* local_cost_function)(const EST_Item *item1, const EST_Item *item2)
EST_DMatrix * error_return
EST_Item * append_daughter(EST_Item *li=0)
float fixed_local_cost(const EST_Item *s1, const EST_Item *s2)
bool dp_match(const EST_Relation &lexical, const EST_Relation &surface, EST_Relation &match, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym)
int trace_back_and_link(int i, int j, EST_Item *p1, EST_Item *p2, const EST_IMatrix &DP_path_i, const EST_IMatrix &DP_path_j, EST_Item *null_sym)
const T & a(ssize_t row, ssize_t col) const
const EST_DMatrix * def_val
bool null_lpf(const int, const int, const int, const int)
void resize(ssize_t n, int set=1)
INLINE ssize_t length() const
number of items in vector.
EST_TVector< EST_Item * > EST_Item_ptr_Vector
EST_FMatrix sub(const EST_FMatrix &a, ssize_t row, ssize_t col)
bool(* local_pruning_function)(const int i, const int j, const int max_i, const int max_j)
bool dp_sub(int i, int j, const EST_Item_ptr_Vector &vr1, const EST_Item_ptr_Vector &vr2, EST_IMatrix &DP_path_i, EST_IMatrix &DP_path_j, local_cost_function lcf, local_pruning_function lpf, EST_Item *null_sym, EST_FMatrix &cost)
INLINE const T & a_no_check(ssize_t row, ssize_t col) const
const access with no bounds check, care recommend
void resize(int rows, int cols, int set=1)
resize matrix
EST_Item * append(EST_Item *si)