56 return s <<
"<<wfst_tstate>>";
59Declare_TList(wfst_tstate)
61#if defined(INSTANTIATE_TEMPLATES)
62#include "../base_class/EST_TList.cc"
64Instantiate_TList(wfst_tstate)
70static void add_transduce_mstate(
const EST_WFST &wfst,
71 const wfst_tstate &
cs,
82 for (p=
in.head(); p != 0; p=p->next())
87 for (p=
out_i.head(); p != 0; p=p->next())
99 wfst_tstate start_state;
102 start_state.state = wfst.start_state();
103 start_state.score = 0;
109 for (i=
in.head(); i != 0; i=i->next())
128 cerr <<
"WFST: found " <<
current_ms->length() <<
" transductions" <<
135 ((*current_ms)(
cs).outs.length() >
out.length()))
138 out = (*current_ms)(
cs).outs;
145static void add_transduce_mstate(
const EST_WFST &wfst,
146 const wfst_tstate &
cs,
158 for (t=
translist.head(); t != 0; t=t->next())
164 wfst_tstate &
ts =
ns.last();
188 for (p=
in.head(); p != 0; p=p->next())
190 if (
in(p).contains(
"/"))
212 int state = wfst.start_state();
216 for (p=
in.head(),
q=
out.head();
217 ((p != 0) && (
q != 0));
218 p=p->next(),
q=
q->next())
222 printf(
"state %d %s/%s -> %d\n",state,
227 if (state == WFST_ERROR_STATE)
233 cerr <<
"wfst recognize: in/out tapes of different lengths"
238 if (wfst.
final(state))
244int recognize_for_perplexity(
const EST_WFST &wfst,
256 for (p=
in.head(); p != 0; p=p->next())
258 if (
in(p).contains(
"/"))
277int recognize_for_perplexity(
const EST_WFST &wfst,
284 int state = wfst.start_state();
291 for (p=
in.head(),
q=
out.head();
292 ((p != 0) && (
q != 0));
293 p=p->next(),
q=
q->next())
302 printf(
"state %d %s/%s -> %d\n",state,
307 if (state == WFST_ERROR_STATE)
313 cerr <<
"wfst recognize: in/out tapes of different lengths"
318 if (wfst.
final(state))
int in_symbol(const EST_String &s) const
Map input symbol to input alphabet index.
int in_epsilon() const
Internal index for input epsilon.
int out_symbol(const EST_String &s) const
Map output symbol to output alphabet index.
int final(int i) const
True if state {\tt i} is final.
int transduce(int state, int in, int &out) const
Transduce in to out from state.
int transition(int state, int in, int out) const
Find (first) new state given in and out symbols.