Skip to content

Commit 9a213be

Browse files
georgthegreatjtrmal
authored andcommitted
Support openfst-1.8.2
1 parent 5ccce55 commit 9a213be

File tree

13 files changed

+28
-49
lines changed

13 files changed

+28
-49
lines changed

src/base/kaldi-types.h

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,16 @@ typedef float BaseFloat;
3939
// we find in the future lacks stdint.h
4040
#include <stdint.h>
4141

42-
// for discussion on what to do if you need compile kaldi
43-
// without OpenFST, see the bottom of this this file
44-
#include <fst/types.h>
45-
46-
namespace kaldi {
47-
using ::int16;
48-
using ::int32;
49-
using ::int64;
50-
using ::uint16;
51-
using ::uint32;
52-
using ::uint64;
53-
typedef float float32;
54-
typedef double double64;
55-
} // end namespace kaldi
56-
57-
// In a theoretical case you decide compile Kaldi without the OpenFST
58-
// comment the previous namespace statement and uncomment the following
59-
/*
60-
namespace kaldi {
61-
typedef int8_t int8;
62-
typedef int16_t int16;
63-
typedef int32_t int32;
64-
typedef int64_t int64;
65-
66-
typedef uint8_t uint8;
67-
typedef uint16_t uint16;
68-
typedef uint32_t uint32;
69-
typedef uint64_t uint64;
70-
typedef float float32;
71-
typedef double double64;
72-
} // end namespace kaldi
73-
*/
42+
typedef int8_t int8;
43+
typedef int16_t int16;
44+
typedef int32_t int32;
45+
typedef int64_t int64;
46+
47+
typedef uint8_t uint8;
48+
typedef uint16_t uint16;
49+
typedef uint32_t uint32;
50+
typedef uint64_t uint64;
51+
typedef float float32;
52+
typedef double double64;
7453

7554
#endif // KALDI_BASE_KALDI_TYPES_H_

src/fstext/lattice-utils-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void ConvertFstToLattice(
270270
fst::CacheOptions cache_opts(true, num_states_cache);
271271
fst::ArcMapFstOptions mapfst_opts(cache_opts);
272272
StdToLatticeMapper<Real> mapper;
273-
MapFst<StdArc, ArcTpl<LatticeWeightTpl<Real> >,
273+
ArcMapFst<StdArc, ArcTpl<LatticeWeightTpl<Real> >,
274274
StdToLatticeMapper<Real> > map_fst(ifst, mapper, mapfst_opts);
275275
*ofst = map_fst;
276276
}

src/kws/kws-functions.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool CreateFactorTransducer(const CompactLattice &clat,
175175

176176
// Now we map the CompactLattice to VectorFst<KwsProductArc>. We drop the
177177
// alignment information and only keep the negated log-probs
178-
Map(clat, factor_transducer, CompactLatticeToKwsProductFstMapper());
178+
ArcMap(clat, factor_transducer, CompactLatticeToKwsProductFstMapper());
179179

180180
// Now do the weight pushing manually on the CompactLattice format. Note that
181181
// the alphas and betas in Kaldi are stored as the log-probs, not the negated
@@ -366,7 +366,7 @@ void MaybeDoSanityCheck(const KwsProductFst &product_transducer) {
366366
if (GetVerboseLevel() < 2) return;
367367
KwsLexicographicFst index_transducer;
368368

369-
Map(product_transducer,
369+
ArcMap(product_transducer,
370370
&index_transducer,
371371
KwsProductFstToKwsLexicographicFstMapper());
372372

src/kws/kws-functions2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void DoFactorMerging(KwsProductFst *factor_transducer,
9292

9393
Decode(&dest_transducer, encoder);
9494

95-
Map(dest_transducer, index_transducer, KwsProductFstToKwsLexicographicFstMapper());
95+
ArcMap(dest_transducer, index_transducer, KwsProductFstToKwsLexicographicFstMapper());
9696
}
9797

9898
void DoFactorDisambiguation(KwsLexicographicFst *index_transducer) {

src/lat/arctic-weight.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ArcticWeightTpl : public FloatWeightTpl<T> {
5050

5151
static const std::string &Type() {
5252
static const std::string type = std::string("arctic") +
53-
FloatWeightTpl<T>::GetPrecisionString();
53+
std::string(FloatWeightTpl<T>::GetPrecisionString());
5454
return type;
5555
}
5656

src/lat/determinize-lattice-pruned.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ bool DeterminizeLatticePhonePrunedWrapper(
14991499
}
15001500
ILabelCompare<kaldi::LatticeArc> ilabel_comp;
15011501
ArcSort(ifst, ilabel_comp);
1502-
ans = DeterminizeLatticePhonePruned<kaldi::LatticeWeight, kaldi::int32>(
1502+
ans = DeterminizeLatticePhonePruned<kaldi::LatticeWeight, int32>(
15031503
trans_model, ifst, beam, ofst, opts);
15041504
Connect(ofst);
15051505
return ans;
@@ -1523,15 +1523,15 @@ bool DeterminizeLatticePruned<kaldi::LatticeWeight>(
15231523
DeterminizeLatticePrunedOptions opts);
15241524

15251525
template
1526-
bool DeterminizeLatticePhonePruned<kaldi::LatticeWeight, kaldi::int32>(
1526+
bool DeterminizeLatticePhonePruned<kaldi::LatticeWeight, int32>(
15271527
const kaldi::TransitionInformation &trans_model,
15281528
const ExpandedFst<kaldi::LatticeArc> &ifst,
15291529
double prune,
15301530
MutableFst<kaldi::CompactLatticeArc> *ofst,
15311531
DeterminizeLatticePhonePrunedOptions opts);
15321532

15331533
template
1534-
bool DeterminizeLatticePhonePruned<kaldi::LatticeWeight, kaldi::int32>(
1534+
bool DeterminizeLatticePhonePruned<kaldi::LatticeWeight, int32>(
15351535
const kaldi::TransitionInformation &trans_model,
15361536
MutableFst<kaldi::LatticeArc> *ifst,
15371537
double prune,

src/lat/minimize-lattice.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ bool MinimizeCompactLattice(
279279

280280
// Instantiate for CompactLattice type.
281281
template
282-
bool MinimizeCompactLattice<kaldi::LatticeWeight, kaldi::int32>(
282+
bool MinimizeCompactLattice<kaldi::LatticeWeight, int32>(
283283
MutableFst<kaldi::CompactLatticeArc> *clat, float delta);
284284

285285

src/lat/push-lattice.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ bool PushCompactLatticeWeights(
280280

281281
// Instantiate for CompactLattice.
282282
template
283-
bool PushCompactLatticeStrings<kaldi::LatticeWeight, kaldi::int32>(
283+
bool PushCompactLatticeStrings<kaldi::LatticeWeight, int32>(
284284
MutableFst<kaldi::CompactLatticeArc> *clat);
285285

286286
template
287-
bool PushCompactLatticeWeights<kaldi::LatticeWeight, kaldi::int32>(
287+
bool PushCompactLatticeWeights<kaldi::LatticeWeight, int32>(
288288
MutableFst<kaldi::CompactLatticeArc> *clat);
289289

290290
} // namespace fst

src/lat/sausages.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ void MinimumBayesRisk::PrepareLatticeAndInitStats(CompactLattice *clat) {
325325
// paper (i.e. just one final state).
326326

327327
// Topologically sort the lattice, if not already sorted.
328-
kaldi::uint64 props = clat->Properties(fst::kFstProperties, false);
328+
uint64 props = clat->Properties(fst::kFstProperties, false);
329329
if (!(props & fst::kTopSorted)) {
330330
if (fst::TopSort(clat) == false)
331331
KALDI_ERR << "Cycles detected in lattice.";

src/nnet3/nnet-batch-compute.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ NnetBatchDecoder::~NnetBatchDecoder() {
15031503
}
15041504
// Print diagnostics.
15051505

1506-
kaldi::int64 input_frame_count =
1506+
int64 input_frame_count =
15071507
frame_count_ * computer_->GetOptions().frame_subsampling_factor;
15081508
int32 num_threads = static_cast<int32>(decode_threads_.size());
15091509

0 commit comments

Comments
 (0)