Skip to content

Commit 3f170d4

Browse files
georgthegreatjtrmal
authored andcommitted
Support openfst-1.7.6
1 parent 6f61393 commit 3f170d4

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

src/chain/chain-supervision.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,8 @@ void Supervision::Write(std::ostream &os, bool binary) const {
571571
// Write using StdAcceptorCompactFst, making use of the fact that it's an
572572
// acceptor.
573573
fst::FstWriteOptions write_options("<unknown>");
574-
fst::StdCompactAcceptorFst::WriteFst(
575-
fst, fst::AcceptorCompactor<fst::StdArc>(), os,
576-
write_options);
574+
fst::StdCompactAcceptorFst cfst(fst);
575+
cfst.Write(os, write_options);
577576
}
578577
} else {
579578
KALDI_ASSERT(e2e_fsts.size() == num_sequences);
@@ -586,9 +585,8 @@ void Supervision::Write(std::ostream &os, bool binary) const {
586585
// Write using StdAcceptorCompactFst, making use of the fact that it's an
587586
// acceptor.
588587
fst::FstWriteOptions write_options("<unknown>");
589-
fst::StdCompactAcceptorFst::WriteFst(
590-
e2e_fsts[i], fst::AcceptorCompactor<fst::StdArc>(), os,
591-
write_options);
588+
fst::StdCompactAcceptorFst cfst(e2e_fsts[i]);
589+
cfst.Write(os, write_options);
592590
}
593591
}
594592
WriteToken(os, binary, "</Fsts>");

src/fstext/fstext-utils-inl.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,12 @@ void GetSymbols(const SymbolTable &symtab,
374374
std::vector<I> *syms_out) {
375375
KALDI_ASSERT(syms_out != NULL);
376376
syms_out->clear();
377-
for (SymbolTableIterator iter(symtab);
378-
!iter.Done();
379-
iter.Next()) {
380-
if (include_eps || iter.Value() != 0) {
381-
syms_out->push_back(iter.Value());
382-
KALDI_ASSERT(syms_out->back() == iter.Value()); // an integer-range thing.
377+
for (SymbolTable::iterator iter = symtab.begin();
378+
iter != symtab.end();
379+
++iter) {
380+
if (include_eps || iter->Label() != 0) {
381+
syms_out->push_back(iter->Label());
382+
KALDI_ASSERT(syms_out->back() == iter->Label()); // an integer-range thing.
383383
}
384384
}
385385
}

src/fstext/kaldi-fst-io-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void WriteFstKaldi(std::ostream &os, bool binary,
4444
bool acceptor = false, write_one = false;
4545
FstPrinter<Arc> printer(t, t.InputSymbols(), t.OutputSymbols(),
4646
NULL, acceptor, write_one, "\t");
47-
printer.Print(&os, "<unknown>");
47+
printer.Print(os, "<unknown>");
4848
if (os.fail())
4949
KALDI_ERR << "Stream failure detected writing FST to stream";
5050
// Write another newline as a terminating character. The read routine will

src/fstext/pre-determinize-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ inline bool HasBannedPrefixPlusDigits(SymbolTable *symTable, std::string prefix,
235235
assert(symTable != NULL);
236236
const char *prefix_ptr = prefix.c_str();
237237
size_t prefix_len = strlen(prefix_ptr); // allowed to be zero but not encouraged.
238-
for (SymbolTableIterator siter(*symTable); !siter.Done(); siter.Next()) {
239-
const std::string &sym = siter.Symbol();
238+
for (SymbolTable::iterator siter = symTable->begin(); siter != symTable->end(); ++siter) {
239+
const std::string &sym = siter->Symbol();
240240
if (!strncmp(prefix_ptr, sym.c_str(), prefix_len)) { // has prefix.
241241
if (isdigit(sym[prefix_len])) { // we don't allow prefix followed by a digit, as a symbol.
242242
// Has at least one digit.

src/kws/kws-functions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bool ClusterLattice(CompactLattice *clat,
7575
unordered_map<StateId, std::vector<Interval> >::iterator iter;
7676
for (iter = head.begin(); iter != head.end(); ++iter) {
7777
// For this ilabel, sort all the arcs on time, from first to last.
78-
sort(iter->second.begin(), iter->second.end(), CompareInterval);
78+
std::sort(iter->second.begin(), iter->second.end(), CompareInterval);
7979
std::vector<Interval> tmp;
8080
tmp.push_back(iter->second[0]);
8181
for (int32 i = 1; i < iter->second.size(); i++) {

src/lat/kaldi-lattice.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ bool WriteCompactLattice(std::ostream &os, bool binary,
7878
fst::FstPrinter<CompactLatticeArc> printer(t, t.InputSymbols(),
7979
t.OutputSymbols(),
8080
NULL, acceptor, write_one, "\t");
81-
printer.Print(&os, "<unknown>");
81+
printer.Print(os, "<unknown>");
8282
if (os.fail())
8383
KALDI_WARN << "Stream failure detected.";
8484
// Write another newline as a terminating character. The read routine will
@@ -403,7 +403,7 @@ bool WriteLattice(std::ostream &os, bool binary, const Lattice &t) {
403403
fst::FstPrinter<LatticeArc> printer(t, t.InputSymbols(),
404404
t.OutputSymbols(),
405405
NULL, acceptor, write_one, "\t");
406-
printer.Print(&os, "<unknown>");
406+
printer.Print(os, "<unknown>");
407407
if (os.fail())
408408
KALDI_WARN << "Stream failure detected.";
409409
// Write another newline as a terminating character. The read routine will

0 commit comments

Comments
 (0)