49 static LISP lts_find_feasible_pairs(LISP rules);
50 static LISP make_fp(LISP in, LISP out);
51 static LISP find_outs(LISP rule);
52 static LISP find_ins(LISP rule);
53 static LISP add_alpha(LISP n, LISP existing);
54 static LISP lts_find_alphabets(LISP rules);
55 static void ltsrule_compile(LISP inalpha, LISP outalpha,
56 LISP
fp, LISP sets, LISP rule,
58 static LISP analyse_rule(LISP rule);
59 static LISP expand_sets(LISP l, LISP
fp, LISP sets);
60 static LISP expand_set(LISP p, LISP
fp, LISP sets);
61 static LISP find_notMAP(LISP MAP,LISP
fp);
71 LISP inalpha,outalpha,alphas;
76 alphas = lts_find_alphabets(lts_rules);
77 inalpha =
car(alphas);
78 outalpha =
cdr(alphas);
80 fp = lts_find_feasible_pairs(rules);
90 for (r=rules; r !=
NIL; r=
cdr(r))
95 ltsrule_compile(inalpha,outalpha,fp,sets,
car(r),a,not_a);
113 static LISP lts_find_alphabets(LISP rules)
121 in = add_alpha(find_ins(
car(r)),in);
122 out = add_alpha(find_outs(
car(r)),out);
128 static LISP add_alpha(LISP n, LISP existing)
134 for (t=n; t !=
NIL; t=
cdr(t))
141 static LISP find_ins(LISP rule)
148 for (c=rule; c !=
NIL; c=
cdr(c))
160 static LISP find_outs(LISP rule)
167 for (c=rule; c !=
NIL; c=
cdr(c))
177 static LISP lts_find_feasible_pairs(LISP rules)
187 for (r=rules; r !=
NIL; r=
cdr(r))
189 LISP in = find_ins(
car(r));
190 LISP out = find_outs(
car(r));
192 LISP pairs = make_fp(in,out);
194 for (LISP p=pairs; p !=
NIL; p=
cdr(p))
203 static LISP make_fp(LISP in, LISP out)
217 for (i=in,o=out ; m > 0; --m,i=
cdr(i),o=
cdr(o))
232 static void ltsrule_compile(LISP inalpha, LISP outalpha,
233 LISP
fp, LISP sets, LISP rule,
240 r = analyse_rule(rule);
245 LC = expand_sets(LC,
fp,sets);
246 RC = expand_sets(RC,
fp,sets);
251 cout <<
"kk rule" << endl;
266 static LISP analyse_rule(LISP rule)
273 for (l=rule; l !=
NIL; l=
cdr(l))
300 static LISP expand_sets(LISP l, LISP
fp, LISP sets)
305 for (r=l; r !=
NIL; r=
cdr(r))
307 LISP s = expand_set(
car(r),
fp,sets);
324 static LISP expand_set(LISP p, LISP
fp, LISP sets)
334 for (s=
set; s !=
NIL; s=
cdr(s))
349 static LISP find_notMAP(LISP MAP,LISP
fp)
353 LISP r,notrp=
NIL,m,np;
356 for (m=MAP; m !=
NIL; m=
cdr(m))
383 if ((s == sr) && (l != lr))
int contains(const char *s, ssize_t pos=-1) const
Does it contain this substring?
a call representing a weighted finite-state transducer
int siod_llength(LISP list)
LISP strintern(const char *data)
LISP append(LISP l1, LISP l2)
void ltscompile(LISP lts_rules, EST_WFST &all_wfst)
void intersection(EST_TList< EST_WFST > &wl)
LISP siod_assoc_str(const char *key, LISP alist)
LISP siod_nth(int nth, LISP list)
const char * get_c_string(LISP x)
void build_from_regex(LISP inalpha, LISP outalpha, LISP regex)
LISP cons(LISP x, LISP y)
void kkrule_compile(LISP inalpha, LISP outalpha, LISP fp, LISP rule, LISP sets)
EST_write_status save(const EST_String &filename, const EST_String type="ascii")
?
void uunion(EST_TList< EST_WFST > &wl)
LISP rintern(const char *name)
EST_String after(int pos, int len=1) const
Part after pos+len.
EST_String before(int pos, int len=0) const
Part before position.
void reverse(EST_Wave &sig)
LISP siod_member_str(const char *key, LISP list)