41#include "EST_cutils.h"
51 cerr <<
"WFST construct: disjunct is nil\n";
69 cerr <<
"WFST build: conjunct is nil\n";
82int EST_WFST::terminal(
LISP l)
92int EST_WFST::operator_or(
LISP l)
94 if (l && !consp(l) && (streq(
"or",get_c_string(l))))
100int EST_WFST::operator_plus(
LISP l)
102 if (l && !consp(l) && (streq(
"+",get_c_string(l))))
108int EST_WFST::operator_not(
LISP l)
110 if (l && !consp(l) && (streq(
"not",get_c_string(l))))
116int EST_WFST::operator_star(
LISP l)
118 if (l && !consp(l) && (streq(
"*",get_c_string(l))))
124int EST_WFST::operator_optional(
LISP l)
126 if (l && !consp(l) && (streq(
"?",get_c_string(l))))
132int EST_WFST::operator_and(
LISP l)
134 if (l && !consp(l) && (streq(
"and",get_c_string(l))))
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)))
195 cout <<
"building from regex: " <<
endl;
203 p_start_state =
add_state(wfst_nonfinal);
const EST_String & name(const int n) const
The name given the index.
int add_state(enum wfst_state_type state_type)
Add a new state, returns new name.
void init(int init_num_states=10)
Clear with (estimation of number of states required)
void clear()
clear removing existing states if any
void build_wfst(int start, int end, LISP regex)
Basic regex constructor.
LISP epsilon_label() const
LISP for on epsilon symbols.
void build_or_transition(int start, int end, LISP disjunctions)
Basic disjunction constructor.
void build_and_transition(int start, int end, LISP conjunctions)
Basic conjunction constructor.