52 if (disjunctions ==
NIL)
53 cerr <<
"WFST construct: disjunct is nil\n";
55 for (l=disjunctions; l !=
NIL; l=
cdr(l))
59 build_wfst(start,intermed,
car(l));
60 build_wfst(intermed,end,epsilon_label());
70 if (conjunctions ==
NIL)
71 cerr <<
"WFST build: conjunct is nil\n";
74 for (l=conjunctions;
cdr(l) !=
NIL; l=
cdr(l))
77 build_wfst(lstart,intermed,
car(l));
80 build_wfst(lstart,end,
car(l));
84 int EST_WFST::terminal(LISP l)
94 int EST_WFST::operator_or(LISP l)
102 int EST_WFST::operator_plus(LISP l)
110 int EST_WFST::operator_not(LISP l)
118 int EST_WFST::operator_star(LISP l)
126 int EST_WFST::operator_optional(LISP l)
134 int EST_WFST::operator_and(LISP l)
151 in = p_in_symbols.name(s_name.
before(
"/"));
152 out = p_out_symbols.name(s_name.
after(
"/"));
159 if ((in == -1) || (out == -1))
161 " not in alphabet\n";
162 p_states[
start]->add_transition(0,end,in,out);
164 else if (operator_or(
car(regex)))
165 build_or_transition(start,end,
cdr(regex));
166 else if (operator_plus(
car(regex)))
168 build_wfst(start,end,
cdr(regex));
169 build_wfst(end,end,
cdr(regex));
171 else if (operator_star(
car(regex)))
173 build_wfst(start,start,
cdr(regex));
174 build_wfst(start,end,epsilon_label());
176 else if (operator_not(
car(regex)))
179 build_and_transition(start,errstate,
cdr(regex));
181 else if (operator_optional(
car(regex)))
183 build_wfst(start,end,
cdr(regex));
184 build_wfst(start,end,epsilon_label());
186 else if (operator_and(
car(regex)))
187 build_and_transition(start,end,
cdr(regex));
189 build_and_transition(start,end,regex);
197 cout <<
"building from regex: " << endl;
200 init(inalpha,outalpha);
207 build_wfst(p_start_state,end,regex);
float end(const EST_Item &item)
int contains(const char *s, ssize_t pos=-1) const
Does it contain this substring?
void build_or_transition(int start, int end, LISP disjunctions)
Basic disjunction constructor.
const char * get_c_string(LISP x)
void build_from_regex(LISP inalpha, LISP outalpha, LISP regex)
float start(const EST_Item &item)
void build_wfst(int start, int end, LISP regex)
Basic regex constructor.
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 build_and_transition(int start, int end, LISP conjunctions)
Basic conjunction constructor.