2424#include " fstext/trivial-factor-weight.h"
2525#include " fstext/fst-test-utils.h"
2626
27+ #include " fstext/openfst_compat.h"
2728
2829namespace fst
2930{
@@ -38,15 +39,15 @@ template<class Arc> void TestDeterminizeGeneral() {
3839 std::cout << " FST before determinizing is:\n " ;
3940 {
4041 FstPrinter<Arc> fstprinter (*fst, NULL , NULL , NULL , false , true , " \t " );
41- fstprinter. Print (& std::cout, " standard output" );
42+ printer_print ( std::cout, fstprinter , " standard output" );
4243 }
4344 VectorFst<Arc> ofst;
4445 try {
4546 DeterminizeStar<Fst<Arc> >(*fst, &ofst, kDelta , NULL , max_states);
4647 std::cout << " FST after determinizing is:\n " ;
4748 {
4849 FstPrinter<Arc> fstprinter (ofst, NULL , NULL , NULL , false , true , " \t " );
49- fstprinter. Print (& std::cout, " standard output" );
50+ printer_print ( std::cout, fstprinter , " standard output" );
5051 }
5152 assert (RandEquivalent (*fst, ofst, 5 /* paths*/ , 0.01 /* delta*/ , kaldi::Rand ()/* seed*/ , 100 /* path length, max*/ ));
5253 } catch (...) {
@@ -101,15 +102,15 @@ template<class Arc> void TestDeterminize() {
101102 std::cout <<" printing before trimming\n " ;
102103 {
103104 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
104- fstprinter. Print (& std::cout, " standard output" );
105+ printer_print ( std::cout, fstprinter , " standard output" );
105106 }
106107 // Trim resulting FST.
107108 Connect (fst);
108109
109110 std::cout <<" printing after trimming\n " ;
110111 {
111112 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
112- fstprinter. Print (& std::cout, " standard output" );
113+ printer_print ( std::cout, fstprinter , " standard output" );
113114 }
114115
115116 VectorFst<Arc> *fst_copy_orig = new VectorFst<Arc>(*fst);
@@ -122,7 +123,7 @@ template<class Arc> void TestDeterminize() {
122123 std::cout <<" printing after predeterminization\n " ;
123124 {
124125 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
125- fstprinter. Print (& std::cout, " standard output" );
126+ printer_print ( std::cout, fstprinter , " standard output" );
126127 }
127128
128129
@@ -138,7 +139,7 @@ template<class Arc> void TestDeterminize() {
138139 std::cout <<" printing after epsilon removal\n " ;
139140 {
140141 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
141- fstprinter. Print (& std::cout, " standard output" );
142+ printer_print ( std::cout, fstprinter , " standard output" );
142143 }
143144 VectorFst<Arc> ofst_orig;
144145 VectorFst<Arc> ofst_star;
@@ -157,14 +158,14 @@ template<class Arc> void TestDeterminize() {
157158 {
158159 std::cout <<" printing after determinization [baseline]\n " ;
159160 FstPrinter<Arc> fstprinter (ofst_orig, sptr, sptr, NULL , false , true , " \t " );
160- fstprinter. Print (& std::cout, " standard output" );
161+ printer_print ( std::cout, fstprinter , " standard output" );
161162 assert (ofst_orig.Properties (kIDeterministic , true ) == kIDeterministic );
162163 }
163164
164165 {
165166 std::cout <<" printing after determinization [star]\n " ;
166167 FstPrinter<Arc> fstprinter (ofst_star, sptr, sptr, NULL , false , true , " \t " );
167- fstprinter. Print (& std::cout, " standard output" );
168+ printer_print ( std::cout, fstprinter , " standard output" );
168169 assert (ofst_star.Properties (kIDeterministic , true ) == kIDeterministic );
169170 }
170171
@@ -174,7 +175,7 @@ template<class Arc> void TestDeterminize() {
174175 std::cout <<" printing after removing " <<num_removed<<" instances of extra symbols\n " ;
175176 {
176177 FstPrinter<Arc> fstprinter (ofst_star, sptr, sptr, NULL , false , true , " \t " );
177- fstprinter. Print (& std::cout, " standard output" );
178+ printer_print ( std::cout, fstprinter , " standard output" );
178179 }
179180
180181 std::cout <<" Checking equivalent to original FST.\n " ;
@@ -242,15 +243,15 @@ template<class Arc> void TestPush() {
242243 std::cout <<" printing before trimming\n " ;
243244 {
244245 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
245- fstprinter. Print (& std::cout, " standard output" );
246+ printer_print ( std::cout, fstprinter , " standard output" );
246247 }
247248 // Trim resulting FST.
248249 Connect (fst);
249250
250251 std::cout <<" printing after trimming\n " ;
251252 {
252253 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
253- fstprinter. Print (& std::cout, " standard output" );
254+ printer_print ( std::cout, fstprinter , " standard output" );
254255 }
255256
256257 VectorFst<Arc> *fst_copy_orig = new VectorFst<Arc>(*fst);
@@ -267,7 +268,7 @@ template<class Arc> void TestPush() {
267268 std::cout <<" printing after pushing\n " ;
268269 {
269270 FstPrinter<Arc> fstprinter (fst_pushed, sptr, sptr, NULL , false , true , " \t " );
270- fstprinter. Print (& std::cout, " standard output" );
271+ printer_print ( std::cout, fstprinter , " standard output" );
271272 }
272273
273274 assert (RandEquivalent (*fst, fst_pushed, 5 /* paths*/ , 0.01 /* delta*/ , kaldi::Rand ()/* seed*/ , 100 /* path length-- max?*/ ));
@@ -320,15 +321,15 @@ template<class Arc> void TestMinimize() {
320321 std::cout <<" printing before trimming\n " ;
321322 {
322323 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
323- fstprinter. Print (& std::cout, " standard output" );
324+ printer_print ( std::cout, fstprinter , " standard output" );
324325 }
325326 // Trim resulting FST.
326327 Connect (fst);
327328
328329 std::cout <<" printing after trimming\n " ;
329330 {
330331 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
331- fstprinter. Print (& std::cout, " standard output" );
332+ printer_print ( std::cout, fstprinter , " standard output" );
332333 }
333334
334335 VectorFst<Arc> *fst_copy_orig = new VectorFst<Arc>(*fst);
@@ -341,7 +342,7 @@ template<class Arc> void TestMinimize() {
341342 std::cout <<" printing after predeterminization\n " ;
342343 {
343344 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
344- fstprinter. Print (& std::cout, " standard output" );
345+ printer_print ( std::cout, fstprinter , " standard output" );
345346 }
346347
347348
@@ -357,7 +358,7 @@ template<class Arc> void TestMinimize() {
357358 std::cout <<" printing after epsilon removal\n " ;
358359 {
359360 FstPrinter<Arc> fstprinter (*fst, sptr, sptr, NULL , false , true , " \t " );
360- fstprinter. Print (& std::cout, " standard output" );
361+ printer_print ( std::cout, fstprinter , " standard output" );
361362 }
362363 VectorFst<Arc> ofst_orig;
363364 VectorFst<Arc> ofst_star;
@@ -370,7 +371,7 @@ template<class Arc> void TestMinimize() {
370371 {
371372 std::cout <<" printing after determinization [baseline]\n " ;
372373 FstPrinter<Arc> fstprinter (ofst_orig, sptr, sptr, NULL , false , true , " \t " );
373- fstprinter. Print (& std::cout, " standard output" );
374+ printer_print ( std::cout, fstprinter , " standard output" );
374375 }
375376
376377
@@ -382,7 +383,7 @@ template<class Arc> void TestMinimize() {
382383 {
383384 std::cout <<" printing after determinization by DeterminizeStar [in gallic]\n " ;
384385 FstPrinter<GallicArc< Arc> > fstprinter (gallic_fst, sptr, sptr, NULL , false , true , " \t " );
385- fstprinter. Print (& std::cout, " standard output" );
386+ printer_print ( std::cout, fstprinter , " standard output" );
386387 }
387388
388389
@@ -392,7 +393,7 @@ template<class Arc> void TestMinimize() {
392393 {
393394 std::cout <<" printing after pushing weights [in gallic]\n " ;
394395 FstPrinter<GallicArc< Arc> > fstprinter (gallic_fst, sptr, sptr, NULL , false , true , " \t " );
395- fstprinter. Print (& std::cout, " standard output" );
396+ printer_print ( std::cout, fstprinter , " standard output" );
396397 }
397398
398399
@@ -401,7 +402,7 @@ template<class Arc> void TestMinimize() {
401402 {
402403 std::cout <<" printing after minimization [in gallic]\n " ;
403404 FstPrinter<GallicArc< Arc> > fstprinter (gallic_fst, sptr, sptr, NULL , false , true , " \t " );
404- fstprinter. Print (& std::cout, " standard output" );
405+ printer_print ( std::cout, fstprinter , " standard output" );
405406 }
406407
407408 printf (" Converting gallic back to regular [my approach]\n " );
@@ -410,15 +411,15 @@ template<class Arc> void TestMinimize() {
410411 {
411412 std::cout <<" printing factor-weight FST\n " ;
412413 FstPrinter<GallicArc< Arc> > fstprinter (fwfst, sptr, sptr, NULL , false , true , " \t " );
413- fstprinter. Print (& std::cout, " standard output" );
414+ printer_print ( std::cout, fstprinter , " standard output" );
414415 }
415416
416417 Map (fwfst, &ofst_star, FromGallicMapper<Arc, GALLIC_LEFT>());
417418
418419 {
419420 std::cout <<" printing after converting back to regular FST\n " ;
420421 FstPrinter<Arc> fstprinter (ofst_star, sptr, sptr, NULL , false , true , " \t " );
421- fstprinter. Print (& std::cout, " standard output" );
422+ printer_print ( std::cout, fstprinter , " standard output" );
422423 }
423424
424425 }
@@ -431,7 +432,7 @@ template<class Arc> void TestMinimize() {
431432 std::cout <<" printing after removing " <<num_removed<<" instances of extra symbols\n " ;
432433 {
433434 FstPrinter<Arc> fstprinter (ofst_star, sptr, sptr, NULL , false , true , " \t " );
434- fstprinter. Print (& std::cout, " standard output" );
435+ printer_print ( std::cout, fstprinter , " standard output" );
435436 }
436437
437438 std::cout <<" Checking equivalent to original FST.\n " ;
0 commit comments