Home | History | Annotate | Download | only in fst

Lines Matching defs:arc

44   // Arc filter.
99 template <class Arc, class ArcFilter>
100 void Prune(MutableFst<Arc> *fst,
101 const PruneOptions<Arc, ArcFilter> &opts) {
102 typedef typename Arc::Weight Weight;
103 typedef typename Arc::StateId StateId;
153 for (MutableArcIterator< MutableFst<Arc> > ait(fst, s);
156 Arc arc = ait.Value();
157 if (!opts.filter(arc)) continue;
158 Weight weight = Times(Times(idistance[s], arc.weight),
159 arc.nextstate < fdistance->size()
160 ? (*fdistance)[arc.nextstate]
163 arc.nextstate = dead[0];
164 ait.SetValue(arc);
167 if (less(Times(idistance[s], arc.weight), idistance[arc.nextstate]))
168 idistance[arc.nextstate] = Times(idistance[s], arc.weight);
169 if (visited[arc.nextstate]) continue;
173 if (enqueued[arc.nextstate] == kNoKey) {
174 enqueued[arc.nextstate] = heap.Insert(arc.nextstate);
177 heap.Update(enqueued[arc.nextstate], arc.nextstate);
196 template <class Arc>
197 void Prune(MutableFst<Arc> *fst,
198 typename Arc::Weight weight_threshold,
199 typename Arc::StateId state_threshold = kNoStateId,
201 PruneOptions<Arc, AnyArcFilter<Arc> > opts(weight_threshold, state_threshold,
202 AnyArcFilter<Arc>(), 0, delta);
216 template <class Arc, class ArcFilter>
217 void Prune(const Fst<Arc> &ifst,
218 MutableFst<Arc> *ofst,
219 const PruneOptions<Arc, ArcFilter> &opts) {
220 typedef typename Arc::Weight Weight;
221 typedef typename Arc::StateId StateId;
279 for (ArcIterator< Fst<Arc> > ait(ifst, s);
282 const Arc &arc = ait.Value();
283 if (!opts.filter(arc)) continue;
284 Weight weight = Times(Times(idistance[s], arc.weight),
285 arc.nextstate < fdistance->size()
286 ? (*fdistance)[arc.nextstate]
292 while (idistance.size() <= arc.nextstate)
294 if (less(Times(idistance[s], arc.weight),
295 idistance[arc.nextstate]))
296 idistance[arc.nextstate] = Times(idistance[s], arc.weight);
297 while (copy.size() <= arc.nextstate)
299 if (copy[arc.nextstate] == kNoStateId)
300 copy[arc.nextstate] = ofst->AddState();
301 ofst->AddArc(copy[s], Arc(arc.ilabel, arc.olabel, arc.weight,
302 copy[arc.nextstate]));
303 while (enqueued.size() <= arc.nextstate) {
307 if (visited[arc.nextstate]) continue;
308 if (enqueued[arc.nextstate] == kNoKey)
309 enqueued[arc.nextstate] = heap.Insert(arc.nextstate);
311 heap.Update(enqueued[arc.nextstate], arc.nextstate);
326 template <class Arc>
327 void Prune(const Fst<Arc> &ifst,
328 MutableFst<Arc> *ofst,
329 typename Arc::Weight weight_threshold,
330 typename Arc::StateId state_threshold = kNoStateId,
332 PruneOptions<Arc, AnyArcFilter<Arc> > opts(weight_threshold, state_threshold,
333 AnyArcFilter<Arc>(), 0, delta);