DeterminizeLatticeTask Class Reference
Collaboration diagram for DeterminizeLatticeTask:

Public Member Functions

 DeterminizeLatticeTask (const TransitionModel &trans_model, fst::DeterminizeLatticePhonePrunedOptions &opts, std::string key, BaseFloat acoustic_scale, BaseFloat beam, Lattice *lat, CompactLatticeWriter *clat_writer, int32 *num_warn)
 
void operator() ()
 
 ~DeterminizeLatticeTask ()
 
 DeterminizeLatticeTask (fst::DeterminizeLatticePrunedOptions &opts, std::string key, BaseFloat acoustic_scale, BaseFloat beam, bool minimize, Lattice *lat, CompactLatticeWriter *clat_writer, int32 *num_warn)
 
void operator() ()
 
 ~DeterminizeLatticeTask ()
 

Private Attributes

const TransitionModeltrans_model_
 
const fst::DeterminizeLatticePhonePrunedOptionsopts_
 
std::string key_
 
BaseFloat acoustic_scale_
 
BaseFloat beam_
 
Latticelat_
 
CompactLattice det_clat_
 
CompactLatticeWriterclat_writer_
 
int32num_warn_
 
const fst::DeterminizeLatticePrunedOptionsopts_
 
bool minimize_
 

Detailed Description

Definition at line 30 of file lattice-determinize-phone-pruned-parallel.cc.

Constructor & Destructor Documentation

◆ DeterminizeLatticeTask() [1/2]

DeterminizeLatticeTask ( const TransitionModel trans_model,
fst::DeterminizeLatticePhonePrunedOptions opts,
std::string  key,
BaseFloat  acoustic_scale,
BaseFloat  beam,
Lattice lat,
CompactLatticeWriter clat_writer,
int32 num_warn 
)
inline

◆ ~DeterminizeLatticeTask() [1/2]

◆ DeterminizeLatticeTask() [2/2]

◆ ~DeterminizeLatticeTask() [2/2]

Member Function Documentation

◆ operator()() [1/2]

void operator() ( )
inline

Definition at line 46 of file lattice-determinize-phone-pruned-parallel.cc.

References DeterminizeLatticeTask::acoustic_scale_, fst::AcousticLatticeScale(), DeterminizeLatticeTask::beam_, DeterminizeLatticeTask::det_clat_, fst::DeterminizeLatticePhonePrunedWrapper(), KALDI_WARN, DeterminizeLatticeTask::key_, DeterminizeLatticeTask::lat_, DeterminizeLatticeTask::opts_, fst::ScaleLattice(), and DeterminizeLatticeTask::trans_model_.

46  {
47  // We apply the acoustic scale before determinization and will undo it
48  // afterward, since it can affect the result.
50 
53  KALDI_WARN << "For key " << key_ << ", determinization did not succeed"
54  "(partial output will be pruned tighter than the specified beam.)";
55  (*num_warn_)++;
56  }
57 
58  delete lat_;
59  lat_ = NULL;
60 
61  // Invert the original acoustic scaling
63  &det_clat_);
64  }
std::vector< std::vector< double > > AcousticLatticeScale(double acwt)
void ScaleLattice(const std::vector< std::vector< ScaleFloat > > &scale, MutableFst< ArcTpl< Weight > > *fst)
Scales the pairs of weights in LatticeWeight or CompactLatticeWeight by viewing the pair (a...
#define KALDI_WARN
Definition: kaldi-error.h:150
const fst::DeterminizeLatticePhonePrunedOptions & opts_
bool DeterminizeLatticePhonePrunedWrapper(const kaldi::TransitionModel &trans_model, MutableFst< kaldi::LatticeArc > *ifst, double beam, MutableFst< kaldi::CompactLatticeArc > *ofst, DeterminizeLatticePhonePrunedOptions opts)
This function is a wrapper of DeterminizeLatticePhonePruned() that works for Lattice type FSTs...

◆ operator()() [2/2]

void operator() ( )
inline

Definition at line 46 of file lattice-determinize-pruned-parallel.cc.

References DeterminizeLatticeTask::acoustic_scale_, fst::AcousticLatticeScale(), DeterminizeLatticeTask::beam_, DeterminizeLatticeTask::det_clat_, fst::DeterminizeLatticePruned(), KALDI_WARN, DeterminizeLatticeTask::key_, DeterminizeLatticeTask::lat_, DeterminizeLatticeTask::minimize_, fst::MinimizeCompactLattice(), DeterminizeLatticeTask::opts_, fst::PushCompactLatticeStrings(), fst::PushCompactLatticeWeights(), and fst::ScaleLattice().

46  {
47  Invert(lat_); // to get word labels on the input side.
48  // We apply the acoustic scale before determinization and will undo it
49  // afterward, since it can affect the result.
51  if (!TopSort(lat_)) {
52  KALDI_WARN << "Could not topologically sort lattice: this probably means it"
53  " has bad properties e.g. epsilon cycles. Your LM or lexicon might "
54  "be broken, e.g. LM with epsilon cycles or lexicon with empty words.";
55  (*num_warn_)++;
56  }
57  fst::ArcSort(lat_, fst::ILabelCompare<LatticeArc>());
59  KALDI_WARN << "For key " << key_ << ", determinization did not succeed"
60  "(partial output will be pruned tighter than the specified beam.)";
61  (*num_warn_)++;
62  }
63  delete lat_; // This is no longer needed so we can delete it now;
64  lat_ = NULL;
65  fst::Connect(&det_clat_); // remove states not leading to any final state,
66  if (minimize_) {
70  }
71  // Invert the original acoustic scaling
73  &det_clat_);
74  }
bool DeterminizeLatticePruned(const ExpandedFst< ArcTpl< Weight > > &ifst, double beam, MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *ofst, DeterminizeLatticePrunedOptions opts)
bool PushCompactLatticeStrings(MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat)
This function pushes the transition-ids as far towards the start as they will go. ...
bool PushCompactLatticeWeights(MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat)
This function pushes the weights in the CompactLattice so that all states except possibly the start s...
std::vector< std::vector< double > > AcousticLatticeScale(double acwt)
bool MinimizeCompactLattice(MutableFst< ArcTpl< CompactLatticeWeightTpl< Weight, IntType > > > *clat, float delta)
This function minimizes the compact lattice.
void ScaleLattice(const std::vector< std::vector< ScaleFloat > > &scale, MutableFst< ArcTpl< Weight > > *fst)
Scales the pairs of weights in LatticeWeight or CompactLatticeWeight by viewing the pair (a...
#define KALDI_WARN
Definition: kaldi-error.h:150
const fst::DeterminizeLatticePhonePrunedOptions & opts_

Member Data Documentation

◆ acoustic_scale_

BaseFloat acoustic_scale_
private

◆ beam_

BaseFloat beam_
private

◆ clat_writer_

◆ det_clat_

◆ key_

◆ lat_

Lattice * lat_
private

◆ minimize_

bool minimize_
private

◆ num_warn_

int32 * num_warn_
private

Definition at line 83 of file lattice-determinize-phone-pruned-parallel.cc.

◆ opts_ [1/2]

◆ opts_ [2/2]

Definition at line 81 of file lattice-determinize-pruned-parallel.cc.

◆ trans_model_

const TransitionModel* trans_model_
private

The documentation for this class was generated from the following files: