|
@ -401,8 +401,8 @@ template |
|
|
inline std::ostream& operator<<(std::ostream& strm, |
|
|
inline std::ostream& operator<<(std::ostream& strm, |
|
|
const LatticeWeightTpl<FloatType>& w) { |
|
|
const LatticeWeightTpl<FloatType>& w) { |
|
|
LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value1()); |
|
|
LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value1()); |
|
|
CHECK(FST_FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
strm << FST_FLAGS_fst_weight_separator[0]; // comma by default; |
|
|
|
|
|
|
|
|
CHECK(FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
strm << FLAGS_fst_weight_separator[0]; // comma by default; |
|
|
// may or may not be settable from Kaldi programs. |
|
|
// may or may not be settable from Kaldi programs. |
|
|
LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value2()); |
|
|
LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value2()); |
|
|
return strm; |
|
|
return strm; |
|
@ -411,9 +411,9 @@ inline std::ostream& operator<<(std::ostream& strm, |
|
|
template <class FloatType> |
|
|
template <class FloatType> |
|
|
inline std::istream& operator>>(std::istream& strm, |
|
|
inline std::istream& operator>>(std::istream& strm, |
|
|
LatticeWeightTpl<FloatType>& w1) { |
|
|
LatticeWeightTpl<FloatType>& w1) { |
|
|
CHECK(FST_FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
|
|
|
CHECK(FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
// separator defaults to ',' |
|
|
// separator defaults to ',' |
|
|
return w1.ReadNoParen(strm, FST_FLAGS_fst_weight_separator[0]); |
|
|
|
|
|
|
|
|
return w1.ReadNoParen(strm, FLAGS_fst_weight_separator[0]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// CompactLattice will be an acceptor (accepting the words/output-symbols), |
|
|
// CompactLattice will be an acceptor (accepting the words/output-symbols), |
|
@ -752,8 +752,8 @@ template |
|
|
inline std::ostream& operator<<( |
|
|
inline std::ostream& operator<<( |
|
|
std::ostream& strm, const CompactLatticeWeightTpl<WeightType, IntType>& w) { |
|
|
std::ostream& strm, const CompactLatticeWeightTpl<WeightType, IntType>& w) { |
|
|
strm << w.Weight(); |
|
|
strm << w.Weight(); |
|
|
CHECK(FST_FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
strm << FST_FLAGS_fst_weight_separator[0]; // comma by default. |
|
|
|
|
|
|
|
|
CHECK(FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
strm << FLAGS_fst_weight_separator[0]; // comma by default. |
|
|
for (size_t i = 0; i < w.String().size(); i++) { |
|
|
for (size_t i = 0; i < w.String().size(); i++) { |
|
|
strm << w.String()[i]; |
|
|
strm << w.String()[i]; |
|
|
if (i + 1 < w.String().size()) |
|
|
if (i + 1 < w.String().size()) |
|
@ -771,8 +771,8 @@ inline std::istream& operator>>( |
|
|
if (strm.fail()) { |
|
|
if (strm.fail()) { |
|
|
return strm; |
|
|
return strm; |
|
|
} |
|
|
} |
|
|
CHECK(FST_FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
size_t pos = s.find_last_of(FST_FLAGS_fst_weight_separator); // normally "," |
|
|
|
|
|
|
|
|
CHECK(FLAGS_fst_weight_separator.size() == 1); // NOLINT |
|
|
|
|
|
size_t pos = s.find_last_of(FLAGS_fst_weight_separator); // normally "," |
|
|
if (pos == std::string::npos) { |
|
|
if (pos == std::string::npos) { |
|
|
strm.clear(std::ios::badbit); |
|
|
strm.clear(std::ios::badbit); |
|
|
return strm; |
|
|
return strm; |
|
|