46#include "EST_cutils.h"
52static int production_index(
LISP state,
91 for (r=rules; r != NIL; r=cdr(r))
92 if (car(car(r)) == car(
nt))
93 nn = cons(cdr(cdr(car(r))),
nn);
105 for (r=rules; r != NIL; r=cdr(r))
106 if (!siod_member_str(get_c_string(car(car(r))),
nonterms))
109 for (r=rules; r != NIL; r=cdr(r))
110 for (s=cdr(cdr(car(r))); s != NIL; s=cdr(s))
111 if ((!siod_member_str(get_c_string(car(s)),
terms)) &&
112 (!siod_member_str(get_c_string(car(s)),
nonterms)) &&
113 (!siod_assoc_str(get_c_string(car(s)),
sets)))
115 else if ((set=siod_assoc_str(get_c_string(car(s)),
sets)))
117 for (t=cdr(set); t != 0; t=cdr(t))
118 if (!siod_member_str(get_c_string(car(t)),
terms))
148 p_start_state =
add_state(wfst_nonfinal);
149 start_state = cons(flocons((
double)p_start_state),
150 cons(distinguished,NIL));
152 production_index(start_state,index,p_start_state);
169 ns = production_index(
remainder,index,p_num_states);
171 for (
LISP s=cdr(set); s != NIL; s=cdr(s))
173 ->add_transition(0.0,
175 p_in_symbols.
name(get_c_string(car(s))),
176 p_out_symbols.
name(get_c_string(car(s))));
179 else if (
ns == p_num_states)
187 ns = production_index(
remainder,index,p_num_states);
190 ->add_transition(0.0,
196 else if (
ns == p_num_states)
209 ns = production_index(
new_prod,index,p_num_states);
211 ->add_transition(0.0,
213 if (
ns == p_num_states)
228static int production_index(
LISP state,
239 for (p=state; p != NIL; p = cdr(p))
244 for (p=state; p != NIL; p = cdr(p))
263 return cons(car(n),prod_join(cdr(n),p));
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
int out_epsilon() const
Internal index for output epsilon.
int in_epsilon() const
Internal index for input epsilon.