Lines Matching refs:Arc

62 template <class Arc, class WeightGenerator>
65 typedef typename Arc::Label Label;
66 typedef typename Arc::StateId StateId;
67 typedef typename Arc::Weight Weight;
69 WeightedTester(int seed, const Fst<Arc> &zero_fst, const Fst<Arc> &one_fst,
70 const Fst<Arc> &univ_fst, WeightGenerator *weight_generator)
74 void Test(const Fst<Arc> &T1, const Fst<Arc> &T2, const Fst<Arc> &T3) {
85 void TestRational(const Fst<Arc> &T1, const Fst<Arc> &T2,
86 const Fst<Arc> &T3) {
90 VectorFst<Arc> U1(T1);
92 UnionFst<Arc> U2(T1, T2);
99 VectorFst<Arc> C1(T1);
101 ConcatFst<Arc> C2(T1, T2);
103 VectorFst<Arc> C3(T2);
110 VectorFst<Arc> C1(T1);
112 ClosureFst<Arc> C2(T1, CLOSURE_STAR);
118 VectorFst<Arc> C1(T1);
120 ClosureFst<Arc> C2(T1, CLOSURE_PLUS);
126 VectorFst<Arc> U1(T1);
130 VectorFst<Arc> U3(T2);
132 VectorFst<Arc> U4(T1);
140 UnionFst<Arc> U1(T1, T2);
141 UnionFst<Arc> U2(U1, T3);
143 UnionFst<Arc> U3(T2, T3);
144 UnionFst<Arc> U4(T1, U3);
152 UnionFst<Arc> U1(T1, T2);
155 UnionFst<Arc> U3(T2, T3);
156 UnionFst<Arc> U4(T1, U3);
163 VectorFst<Arc> C1(T1);
167 VectorFst<Arc> C3(T2);
169 VectorFst<Arc> C4(T1);
177 ConcatFst<Arc> C1(T1, T2);
178 ConcatFst<Arc> C2(C1, T3);
180 ConcatFst<Arc> C3(T2, T3);
181 ConcatFst<Arc> C4(T1, C3);
188 ConcatFst<Arc> C1(T1, T2);
191 ConcatFst<Arc> C3(T2, T3);
192 ConcatFst<Arc> C4(T1, C3);
201 VectorFst<Arc> U1(T1);
203 VectorFst<Arc> C1(T3);
206 VectorFst<Arc> C2(T3);
208 VectorFst<Arc> C3(T3);
210 VectorFst<Arc> U2(C2);
219 VectorFst<Arc> U1(T1);
221 VectorFst<Arc> C1(U1);
224 VectorFst<Arc> C2(T1);
226 VectorFst<Arc> C3(T2);
228 VectorFst<Arc> U2(C2);
236 UnionFst<Arc> U1(T1, T2);
237 ConcatFst<Arc> C1(T3, U1);
239 ConcatFst<Arc> C2(T3, T1);
240 ConcatFst<Arc> C3(T3, T2);
241 UnionFst<Arc> U2(C2, C3);
248 UnionFst<Arc> U1(T1, T2);
249 ConcatFst<Arc> C1(U1, T3);
251 ConcatFst<Arc> C2(T1, T3);
252 ConcatFst<Arc> C3(T2, T3);
253 UnionFst<Arc> U2(C2, C3);
261 VectorFst<Arc> S(T1);
263 VectorFst<Arc> C(T1);
266 VectorFst<Arc> P(T1);
275 VectorFst<Arc> S(T1);
277 VectorFst<Arc> C(S);
280 VectorFst<Arc> P(T1);
288 ClosureFst<Arc> S(T1, CLOSURE_STAR);
289 ConcatFst<Arc> C(T1, S);
291 ClosureFst<Arc> P(T1, CLOSURE_PLUS);
298 ClosureFst<Arc> S(T1, CLOSURE_STAR);
299 ConcatFst<Arc> C(S, T1);
301 ClosureFst<Arc> P(T1, CLOSURE_PLUS);
308 void TestMap(const Fst<Arc> &T) {
312 VectorFst<Arc> P1(T);
314 ProjectFst<Arc> P2(T, PROJECT_INPUT);
321 VectorFst<Arc> I1(T);
323 InvertFst<Arc> I2(T);
329 VectorFst<Arc> P1(T);
330 VectorFst<Arc> I1(T);
339 VectorFst<Arc> P1(T);
340 VectorFst<Arc> I1(T);
349 ProjectFst<Arc> P1(T, PROJECT_INPUT);
350 InvertFst<Arc> I1(T);
351 ProjectFst<Arc> P2(I1, PROJECT_OUTPUT);
358 ProjectFst<Arc> P1(T, PROJECT_OUTPUT);
359 InvertFst<Arc> I1(T);
360 ProjectFst<Arc> P2(I1, PROJECT_INPUT);
381 VectorFst<Arc> R(T);
394 RelabelFst<Arc> Rdelay(T, ipairs1, opairs1);
396 RelabelFst<Arc> RRdelay(Rdelay, ipairs2, opairs2);
402 VectorFst<Arc> D(T);
408 EncodeMapper<Arc> encoder(encode_props, ENCODE);
421 EncodeMapper<Arc> encoder(encode_props, ENCODE);
422 EncodeFst<Arc> E(T, &encoder);
423 VectorFst<Arc> Encoded(E);
424 DecodeFst<Arc> D(Encoded, encoder);
430 ToGallicMapper<Arc> to_mapper;
431 FromGallicMapper<Arc> from_mapper;
432 VectorFst< GallicArc<Arc> > G;
433 VectorFst<Arc> F;
441 ToGallicMapper<Arc> to_mapper;
442 FromGallicMapper<Arc> from_mapper;
443 ArcMapFst<Arc, GallicArc<Arc>, ToGallicMapper<Arc> >
445 ArcMapFst<GallicArc<Arc>, Arc, FromGallicMapper<Arc> >
452 void TestCompose(const Fst<Arc> &T1, const Fst<Arc> &T2,
453 const Fst<Arc> &T3) {
457 VectorFst<Arc> S1(T1);
458 VectorFst<Arc> S2(T2);
459 VectorFst<Arc> S3(T3);
461 ILabelCompare<Arc> icomp;
462 OLabelCompare<Arc> ocomp;
470 ComposeFst<Arc> C1(S1, S2);
472 ComposeFst<Arc> C2(C1, S3);
473 ComposeFst<Arc> C3(S2, S3);
474 ComposeFst<Arc> C4(S1, C3);
481 UnionFst<Arc> U1(S2, S3);
482 ComposeFst<Arc> C1(S1, U1);
484 ComposeFst<Arc> C2(S1, S2);
485 ComposeFst<Arc> C3(S1, S3);
486 UnionFst<Arc> U2(C2, C3);
493 UnionFst<Arc> U1(S1, S2);
494 ComposeFst<Arc> C1(U1, S3);
496 ComposeFst<Arc> C2(S1, S3);
497 ComposeFst<Arc> C3(S2, S3);
498 UnionFst<Arc> U2(C2, C3);
503 VectorFst<Arc> A1(S1);
504 VectorFst<Arc> A2(S2);
505 VectorFst<Arc> A3(S3);
512 IntersectFst<Arc> I1(A1, A2);
513 IntersectFst<Arc> I2(A2, A1);
519 typedef Matcher< Fst<Arc> > M;
520 ComposeFst<Arc> C1(S1, S2);
521 ComposeFst<Arc> C2(
523 ComposeFstOptions<Arc, M, AltSequenceComposeFilter<M> >());
524 ComposeFst<Arc> C3(
526 ComposeFstOptions<Arc, M, MatchComposeFilter<M> >());
534 void TestSort(const Fst<Arc> &T) {
535 ILabelCompare<Arc> icomp;
536 OLabelCompare<Arc> ocomp;
540 VectorFst<Arc> S1(T);
547 VectorFst<Arc> S1(T);
549 ArcSortFst< Arc, ILabelCompare<Arc> > S2(T, icomp);
555 VectorFst<Arc> S1(T);
556 VectorFst<Arc> S2(T);
566 VectorFst<Arc> S1(T);
573 VectorFst< ReverseArc<Arc> > R1;
574 VectorFst<Arc> R2;
582 void TestOptimize(const Fst<Arc> &T) {
586 VectorFst<Arc> A(T);
591 VectorFst<Arc> C1(T);
599 VectorFst<Arc> R1(T);
605 RmEpsilonFst<Arc> R2(T);
612 VectorFst<Arc> U;
613 ArcMap(T, &U, EpsMapper<Arc>());
614 VectorFst<Arc> V;
616 Arc arc(1, 1, Weight::One(), V.AddState());
625 VectorFst<Arc> U1(U);
630 RmEpsilonFst<Arc> U2(U);
638 DeterminizeFst<Arc> D(A);
646 VectorFst<Arc> M(D);
662 VectorFst<Arc> R;
665 DeterminizeFst<Arc> DR(R);
666 VectorFst<Arc> RD;
668 DeterminizeFst<Arc> DRD(RD);
669 VectorFst<Arc> M(DRD);
675 if (Arc::Type() == LogArc::Type() || Arc::Type() == StdArc::Type()) {
678 VectorFst<Arc> RI(T);
679 VectorFst<Arc> RF(T);
694 VectorFst<Arc> P1;
695 Push<Arc, REWEIGHT_TO_FINAL>(T, &P1, kPushLabels);
698 VectorFst<Arc> P2;
699 Push<Arc, REWEIGHT_TO_FINAL>(T, &P2, kPushWeights);
702 VectorFst<Arc> P3;
703 Push<Arc, REWEIGHT_TO_FINAL>(T, &P3, kPushLabels | kPushWeights);
709 VectorFst<Arc> P1;
710 Push<Arc, REWEIGHT_TO_INITIAL>(T, &P1, kPushLabels);
713 VectorFst<Arc> P2;
714 Push<Arc, REWEIGHT_TO_INITIAL>(T, &P2, kPushWeights);
716 VectorFst<Arc> P3;
717 Push<Arc, REWEIGHT_TO_INITIAL>(T, &P3, kPushLabels | kPushWeights);
727 VectorFst<Arc> P1(T);
729 VectorFst<Arc> P2;
737 VectorFst< ReverseArc<Arc> > R;
738 VectorFst<Arc> P1(T);
739 VectorFst<Arc> P2;
750 VectorFst<Arc> P;
752 DifferenceFst<Arc> C(A, DeterminizeFst<Arc>
753 (RmEpsilonFst<Arc>
754 (ArcMapFst<Arc, Arc,
755 RmWeightMapper<Arc> >
756 (P, RmWeightMapper<Arc>()))));
764 SynchronizeFst<Arc> S(T);
770 void TestSearch(const Fst<Arc> &T) {
773 VectorFst<Arc> A(T);
778 VectorFst<Arc> path;
787 VectorFst<Arc> R(A);
790 VectorFst<Arc> paths;
797 ArcIterator< Fst<Arc> > piter(paths, pstart);
802 VectorFst<Arc> path;
806 ArcMap(&path, RmWeightMapper<Arc>());
807 VectorFst<Arc> S;
817 bool Equiv(const Fst<Arc> &fst1, const Fst<Arc> &fst2) {
822 UniformArcSelector<Arc> uniform_selector(seed_);
823 RandGenOptions< UniformArcSelector<Arc> >
832 VectorFst<Arc> zero_fst_;
835 VectorFst<Arc> one_fst_;
838 VectorFst<Arc> univ_fst_;
880 template <class Arc>
883 UnweightedTester(const Fst<Arc> &zero_fsa, const Fst<Arc> &one_fsa,
884 const Fst<Arc> &univ_fsa) {}
886 void Test(const Fst<Arc> &A1, const Fst<Arc> &A2, const Fst<Arc> &A3) {}
896 typedef StdArc Arc;
897 typedef Arc::Label Label;
898 typedef Arc::StateId StateId;
899 typedef Arc::Weight Weight;
901 UnweightedTester(const Fst<Arc> &zero_fsa, const Fst<Arc> &one_fsa,
902 const Fst<Arc> &univ_fsa)
905 void Test(const Fst<Arc> &A1, const Fst<Arc> &A2, const Fst<Arc> &A3) {
913 void TestRational(const Fst<Arc> &A1, const Fst<Arc> &A2,
914 const Fst<Arc> &A3) {
918 VectorFst<Arc> U(A1);
927 UnionFst<Arc> U(A1, A2);
935 VectorFst<Arc> C(one_fsa_);
940 VectorFst<Arc> S(A1);
948 Fst<Arc> *C = new VectorFst<Arc>(one_fsa_);
950 ConcatFst<Arc> *F = new ConcatFst<Arc>(*C, A1);
954 ClosureFst<Arc> S(A1, CLOSURE_STAR);
961 void TestIntersect(const Fst<Arc> &A1, const Fst<Arc> &A2,
962 const Fst<Arc> &A3) {
963 VectorFst<Arc> S1(A1);
964 VectorFst<Arc> S2(A2);
965 VectorFst<Arc> S3(A3);
967 ILabelCompare<Arc> comp;
975 IntersectFst<Arc> I1(S1, S2);
982 IntersectFst<Arc> I1(S1, S2);
983 UnionFst<Arc> U1(I1, S3);
985 UnionFst<Arc> U2(S1, S3);
986 UnionFst<Arc> U3(S2, S3);
987 ArcSortFst< Arc, ILabelCompare<Arc> > S4(U3, comp);
988 IntersectFst<Arc> I2(U2, S4);
993 VectorFst<Arc> C1;
994 VectorFst<Arc> C2;
1003 UnionFst<Arc> U(S1, C1);
1009 IntersectFst<Arc> I(S1, C1);
1015 UnionFst<Arc> U(C1, C2);
1017 IntersectFst<Arc> I(S1, S2);
1018 VectorFst<Arc> C3;
1025 IntersectFst<Arc> I(C1, C2);
1027 UnionFst<Arc> U(S1, S2);
1028 VectorFst<Arc> C3;
1035 void TestOptimize(const Fst<Arc> &A) {
1038 DeterminizeFst<Arc> D(A);
1046 RmEpsilonFst<Arc> R(A);
1047 DeterminizeFst<Arc> D(R);
1048 VectorFst<Arc> M(D);
1057 VectorFst<Arc> R;
1060 DeterminizeFst<Arc> DR(R);
1061 VectorFst<Arc> RD;
1063 DeterminizeFst<Arc> DRD(RD);
1064 VectorFst<Arc> M(DRD);
1072 bool Equiv(const Fst<Arc> &fsa1, const Fst<Arc> &fsa2) {
1077 VectorFst<Arc> vfsa1(fsa1);
1078 VectorFst<Arc> vfsa2(fsa2);
1081 DeterminizeFst<Arc> dfa1(vfsa1);
1082 DeterminizeFst<Arc> dfa2(vfsa2);
1088 ILabelCompare<Arc> comp;
1089 VectorFst<Arc> sdfa1(dfa1);
1091 VectorFst<Arc> sdfa2(dfa2);
1094 DifferenceFst<Arc> dfsa1(sdfa1, sdfa2);
1095 DifferenceFst<Arc> dfsa2(sdfa2, sdfa1);
1097 VectorFst<Arc> ufsa(dfsa1);
1109 bool Subset(const Fst<Arc> &fsa1, const Fst<Arc> &fsa2) {
1128 void Complement(const Fst<Arc> &ifsa, MutableFst<Arc> *ofsa) {
1129 RmEpsilonFst<Arc> rfsa(ifsa);
1130 DeterminizeFst<Arc> dfa(rfsa);
1131 DifferenceFst<Arc> cfsa(univ_fsa_, dfa);
1136 VectorFst<Arc> zero_fsa_;
1139 VectorFst<Arc> one_fsa_;
1142 VectorFst<Arc> univ_fsa_;
1152 template <class Arc, class WeightGenerator>
1155 typedef typename Arc::Label Label;
1156 typedef typename Arc::StateId StateId;
1157 typedef typename Arc::Weight Weight;
1169 univ_fst_.AddArc(0, Arc(i, i, Weight::One(), 0));
1177 VectorFst<Arc> T1;
1178 VectorFst<Arc> T2;
1179 VectorFst<Arc> T3;
1183 WeightedTester<Arc, WeightGenerator>
1188 VectorFst<Arc> A1(T1);
1189 VectorFst<Arc> A2(T2);
1190 VectorFst<Arc> A3(T3);
1197 UnweightedTester<Arc> unweighted_tester(zero_fst_, one_fst_, univ_fst_);
1204 void RandFst(MutableFst<Arc> *fst) {
1228 Arc arc;
1269 VectorFst<Arc> zero_fst_;
1272 VectorFst<Arc> one_fst_;
1275 VectorFst<Arc> univ_fst_;
1278 RmWeightMapper<Arc> rm_weight_mapper;