41 #include "EST_cutils.h"
50 if (disjunctions == NIL)
51 cerr <<
"WFST construct: disjunct is nil\n";
53 for (l=disjunctions; l != NIL; l=cdr(l))
68 if (conjunctions == NIL)
69 cerr <<
"WFST build: conjunct is nil\n";
72 for (l=conjunctions; cdr(l) != NIL; l=cdr(l))
82 int EST_WFST::terminal(LISP l)
92 int EST_WFST::operator_or(LISP l)
94 if (l && !consp(l) && (streq(
"or",get_c_string(l))))
100 int EST_WFST::operator_plus(LISP l)
102 if (l && !consp(l) && (streq(
"+",get_c_string(l))))
108 int EST_WFST::operator_not(LISP l)
110 if (l && !consp(l) && (streq(
"not",get_c_string(l))))
116 int EST_WFST::operator_star(LISP l)
118 if (l && !consp(l) && (streq(
"*",get_c_string(l))))
124 int EST_WFST::operator_optional(LISP l)
126 if (l && !consp(l) && (streq(
"?",get_c_string(l))))
132 int EST_WFST::operator_and(LISP l)
134 if (l && !consp(l) && (streq(
"and",get_c_string(l))))
150 out = p_out_symbols.
name(s_name.
after(
"/"));
154 in = p_in_symbols.
name(get_c_string(regex));
155 out = p_out_symbols.
name(get_c_string(regex));
157 if ((in == -1) || (out == -1))
158 cerr <<
"WFST_build: symbol " << get_c_string(regex) <<
159 " not in alphabet\n";
160 p_states[start]->add_transition(0,end,in,out);
162 else if (operator_or(car(regex)))
164 else if (operator_plus(car(regex)))
169 else if (operator_star(car(regex)))
174 else if (operator_not(car(regex)))
179 else if (operator_optional(car(regex)))
184 else if (operator_and(car(regex)))
190 void EST_WFST::build_from_regex(LISP inalpha, LISP outalpha, LISP regex)
195 cout <<
"building from regex: " << endl;
198 init(inalpha,outalpha);
203 p_start_state =
add_state(wfst_nonfinal);