diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h index 7ebf4f853..c376604a4 100644 --- a/src/base/kaldi-types.h +++ b/src/base/kaldi-types.h @@ -39,24 +39,21 @@ typedef float BaseFloat; // we find in the future lacks stdint.h #include -// for discussion on what to do if you need compile kaldi -// without OpenFST, see the bottom of this this file -#include +#include // for ssize_t. +#include // for ?int*_t. -namespace kaldi { - using ::int16; - using ::int32; - using ::int64; - using ::uint16; - using ::uint32; - using ::uint64; - typedef float float32; - typedef double double64; -} // end namespace kaldi +using int8 = int8_t; +using int16 = int16_t; +using int32 = int32_t; +using int64 = int64_t; + +using uint8 = uint8_t; +using uint16 = uint16_t; +using uint32 = uint32_t; +using uint64 = uint64_t; // In a theoretical case you decide compile Kaldi without the OpenFST // comment the previous namespace statement and uncomment the following -/* namespace kaldi { typedef int8_t int8; typedef int16_t int16; @@ -70,6 +67,5 @@ namespace kaldi { typedef float float32; typedef double double64; } // end namespace kaldi -*/ #endif // KALDI_BASE_KALDI_TYPES_H_ diff --git a/src/configure b/src/configure index c74d67af8..84286da01 100755 --- a/src/configure +++ b/src/configure @@ -929,7 +929,7 @@ fi OPENFST_VER=${OPENFST_VER:-$(grep 'PACKAGE_VERSION' $FSTROOT/Makefile | sed -e 's:.*= ::')} 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 echo "OPENFSTINC = $FSTROOT/include" >> kaldi.mk if $static_fst ; then diff --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h index f7bb3a7c2..01047919c 100644 --- a/src/fstext/kaldi-fst-io-inl.h +++ b/src/fstext/kaldi-fst-io-inl.h @@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary, fst->DeleteStates(); string line; size_t nline = 0; - string separator = FLAGS_fst_field_separator + "\r\n"; + string separator = FST_FLAGS_fst_field_separator + "\r\n"; while (std::getline(is, line)) { nline++; vector col; diff --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h index 7637c4d1c..2d82c5647 100644 --- a/src/fstext/lattice-weight.h +++ b/src/fstext/lattice-weight.h @@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl &w1, template inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl &w) { LatticeWeightTpl::WriteFloatType(strm, w.Value1()); - CHECK(FLAGS_fst_weight_separator.size() == 1); - strm << FLAGS_fst_weight_separator[0]; // comma by default; + CHECK(FST_FLAGS_fst_weight_separator.size() == 1); + strm << FST_FLAGS_fst_weight_separator[0]; // comma by default; // may or may not be settable from Kaldi programs. LatticeWeightTpl::WriteFloatType(strm, w.Value2()); return strm; @@ -405,9 +405,9 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl inline std::istream &operator >>(std::istream &strm, LatticeWeightTpl &w1) { - CHECK(FLAGS_fst_weight_separator.size() == 1); + CHECK(FST_FLAGS_fst_weight_separator.size() == 1); // separator defaults to ',' - return w1.ReadNoParen(strm, FLAGS_fst_weight_separator[0]); + return w1.ReadNoParen(strm, FST_FLAGS_fst_weight_separator[0]); } @@ -728,8 +728,8 @@ inline CompactLatticeWeightTpl Divide(const CompactLatticeW template inline std::ostream &operator <<(std::ostream &strm, const CompactLatticeWeightTpl &w) { strm << w.Weight(); - CHECK(FLAGS_fst_weight_separator.size() == 1); - strm << FLAGS_fst_weight_separator[0]; // comma by default. + CHECK(FST_FLAGS_fst_weight_separator.size() == 1); + strm << FST_FLAGS_fst_weight_separator[0]; // comma by default. for(size_t i = 0; i < w.String().size(); i++) { strm << w.String()[i]; if (i+1 < w.String().size()) @@ -745,8 +745,8 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl > template inline void TrivialFactorWeightFst::InitStateIterator( StateIteratorData *data) const { - data->base = fst::make_unique > >(*this); + data->base = std::make_unique > >(*this); } diff --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc index 648e67115..70fde5acf 100644 --- a/src/lat/kaldi-lattice.cc +++ b/src/lat/kaldi-lattice.cc @@ -114,7 +114,7 @@ class LatticeReader { CompactLattice *cfst = new CompactLattice(); string line; size_t nline = 0; - string separator = FLAGS_fst_field_separator + "\r\n"; + string separator = FST_FLAGS_fst_field_separator + "\r\n"; while (std::getline(is, line)) { nline++; vector col; diff --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc index 6172610dc..a8cd7b7e2 100644 --- a/src/lat/lattice-functions-transition-model.cc +++ b/src/lat/lattice-functions-transition-model.cc @@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info, int32 num_paths = 5, seed = Rand(), max_path_length = -1; BaseFloat delta = 0.2; // some lattices have large costs -> use large delta. - FLAGS_v = GetVerboseLevel(); // set the OpenFst verbose level to the Kaldi + FST_FLAGS_v = GetVerboseLevel(); // set the OpenFst verbose level to the Kaldi // verbose level. if (!RandEquivalent(clat, aligned_clat, num_paths, delta, seed, max_path_length)) { KALDI_WARN << "Equivalence test failed during lattice alignment."; return false; } - FLAGS_v = 0; + FST_FLAGS_v = 0; return (num_err == 0); }