-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Support for both OpenFST 1.7.3 and 1.8.2 #4927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f170d4
e460d8a
5ccce55
9a213be
57efb6b
a7fcc2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -571,9 +571,8 @@ void Supervision::Write(std::ostream &os, bool binary) const { | |
// Write using StdAcceptorCompactFst, making use of the fact that it's an | ||
// acceptor. | ||
fst::FstWriteOptions write_options("<unknown>"); | ||
fst::StdCompactAcceptorFst::WriteFst( | ||
fst, fst::AcceptorCompactor<fst::StdArc>(), os, | ||
write_options); | ||
fst::StdCompactAcceptorFst cfst(fst); | ||
cfst.Write(os, write_options); | ||
Comment on lines
+574
to
+575
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this pre-1.8 compatible? Should we go flat out 1.8+? We've had the version of OpenFST fixed pretty much forever. |
||
} | ||
} else { | ||
KALDI_ASSERT(e2e_fsts.size() == num_sequences); | ||
|
@@ -586,9 +585,8 @@ void Supervision::Write(std::ostream &os, bool binary) const { | |
// Write using StdAcceptorCompactFst, making use of the fact that it's an | ||
// acceptor. | ||
fst::FstWriteOptions write_options("<unknown>"); | ||
fst::StdCompactAcceptorFst::WriteFst( | ||
e2e_fsts[i], fst::AcceptorCompactor<fst::StdArc>(), os, | ||
write_options); | ||
fst::StdCompactAcceptorFst cfst(e2e_fsts[i]); | ||
cfst.Write(os, write_options); | ||
} | ||
} | ||
WriteToken(os, binary, "</Fsts>"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
|
||
# This should be incremented after any significant change to the configure | ||
# script, i.e. any change affecting kaldi.mk or the build system as a whole. | ||
CONFIGURE_VERSION=14 | ||
CONFIGURE_VERSION=15 | ||
|
||
# We support bash version 3.2 (Macs still ship with this version as of 2019) | ||
# and above. | ||
|
@@ -1024,6 +1024,14 @@ OPENFST_VER_NUM=$(echo $OPENFST_VER | sed 's/\./ /g' | xargs printf "%d%02d%02d" | |
if [ $OPENFST_VER_NUM -lt 10600 ]; then | ||
failure "OpenFst-$OPENFST_VER is not supported. You need OpenFst >= 1.6.0.)" | ||
fi | ||
|
||
if [ $OPENFST_VER_NUM -lt 10800 ]; then | ||
echo "CXXLANGVERSION = c++14" | ||
else | ||
echo "CXXLANGVERSION = c++17" | ||
fi >> kaldi.mk | ||
Comment on lines
+1028
to
+1032
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you think of a case when we would run into a pre-C++14 compiler? Maybe it's time to go C++17 unconditionally? |
||
|
||
echo "OPENFSTVER = $OPENFST_VER_NUM" >> kaldi.mk | ||
echo "OPENFSTINC = $FSTROOT/include" >> kaldi.mk | ||
if $static_fst ; then | ||
OPENFSTLIBS="$FSTROOT/lib/libfst.a" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
#include "fstext/fst-test-utils.h" | ||
#include "base/kaldi-math.h" | ||
|
||
#include "fstext/openfst_compat.h" | ||
|
||
Comment on lines
22
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sort |
||
namespace fst { | ||
using std::vector; | ||
using std::cout; | ||
|
@@ -94,7 +96,7 @@ template<class Arc> void TestDeterminizeLattice() { | |
std::cout << "FST before lattice-determinizing is:\n"; | ||
{ | ||
FstPrinter<Arc> fstprinter(*fst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
VectorFst<Arc> det_fst; | ||
try { | ||
|
@@ -106,7 +108,7 @@ template<class Arc> void TestDeterminizeLattice() { | |
std::cout << "FST after lattice-determinizing is:\n"; | ||
{ | ||
FstPrinter<Arc> fstprinter(det_fst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
assert(det_fst.Properties(kIDeterministic, true) & kIDeterministic); | ||
// OK, now determinize it a different way and check equivalence. | ||
|
@@ -117,7 +119,7 @@ template<class Arc> void TestDeterminizeLattice() { | |
std::cout << "Compact FST is:\n"; | ||
{ | ||
FstPrinter<CompactArc> fstprinter(compact_fst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
if (kaldi::Rand() % 2 == 1) | ||
ConvertLattice<Weight, Int>(det_fst, &compact_det_fst, false); | ||
|
@@ -128,7 +130,7 @@ template<class Arc> void TestDeterminizeLattice() { | |
std::cout << "Compact version of determinized FST is:\n"; | ||
{ | ||
FstPrinter<CompactArc> fstprinter(compact_det_fst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
|
||
assert(RandEquivalent(compact_det_fst, compact_fst, 5/*paths*/, 0.01/*delta*/, kaldi::Rand()/*seed*/, 100/*path length, max*/)); | ||
|
@@ -149,14 +151,14 @@ template<class Arc> void TestDeterminizeLattice2() { | |
std::cout << "FST before lattice-determinizing is:\n"; | ||
{ | ||
FstPrinter<Arc> fstprinter(*fst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
VectorFst<Arc> ofst; | ||
DeterminizeLattice<TropicalWeight, int32>(*fst, &ofst); | ||
std::cout << "FST after lattice-determinizing is:\n"; | ||
{ | ||
FstPrinter<Arc> fstprinter(ofst, NULL, NULL, NULL, false, true, "\t"); | ||
fstprinter.Print(&std::cout, "standard output"); | ||
printer_print(std::cout, fstprinter, "standard output"); | ||
} | ||
delete fst; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this?