21 #ifndef KALDI_NNET3_DISCRIMINATIVE_SUPERVISION_H 22 #define KALDI_NNET3_DISCRIMINATIVE_SUPERVISION_H 30 namespace discriminative {
43 remove_output_symbols(true), collapse_transition_ids(true),
44 remove_epsilons(true), determinize(true),
45 minimize(true), acoustic_scale(0.1) { }
48 opts->
Register(
"collapse-transition-ids", &collapse_transition_ids,
49 "If true, modify the transition-ids on denominator lattice " 50 "so that on each frame, there is just one with any given " 51 "pdf-id. This allows us to determinize and minimize " 53 opts->
Register(
"remove-output-symbols", &remove_output_symbols,
54 "Remove output symbols from lattice to convert it to an " 55 "acceptor and make it more determinizable");
56 opts->
Register(
"remove-epsilons", &remove_epsilons,
57 "Remove epsilons from the split lattices");
58 opts->
Register(
"determinize", &determinize,
"If true, we determinize " 59 "lattices (as Lattice) after splitting and possibly minimize");
60 opts->
Register(
"minimize", &minimize,
"If true, we push and " 61 "minimize lattices (as Lattice) after splitting");
62 opts->
Register(
"acoustic-scale", &acoustic_scale,
63 "Scaling factor for acoustic likelihoods (should match the " 64 "value used in discriminative-get-supervision)");
107 frames_per_sequence(-1) { }
117 bool Initialize(
const std::vector<int32> &alignment,
130 return num_sequences * frames_per_sequence;
133 void Write(std::ostream &os,
bool binary)
const;
134 void Read(std::istream &is,
bool binary);
162 void GetFrameRange(
int32 begin_frame,
int32 frames_per_sequence,
167 inline const Lattice&
DenLat()
const {
return den_lat_; }
178 void CreateRangeLattice(
const Lattice &in_lat,
180 int32 begin_frame,
int32 end_frame,
bool normalize,
181 Lattice *out_lat)
const;
202 void ComputeLatticeScores(
const Lattice &lat,
LatticeInfo *scores)
const;
208 void PrepareLattice(Lattice *lat,
LatticeInfo *scores)
const;
213 void CollapseTransitionIds(
const std::vector<int32> &state_times,
225 void MergeSupervision(
const std::vector<const DiscriminativeSupervision*> &input,
232 #endif // KALDI_NNET3_DISCRIMINATIVE_SUPERVISION_H This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
fst::ArcTpl< LatticeWeight > LatticeArc
void Register(OptionsItf *opts)
const SplitDiscriminativeSupervisionOptions & config_
int32 frame_subsampling_factor
std::vector< double > alpha
const TransitionModel & tmodel_
void MergeSupervision(const std::vector< const DiscriminativeSupervision *> &input, DiscriminativeSupervision *output_supervision)
This function appends a list of supervision objects to create what will usually be a single such obje...
std::vector< double > beta
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
LatticeInfo den_lat_scores_
bool collapse_transition_ids
std::vector< int32 > num_ali
const DiscriminativeSupervision & supervision_
const Lattice & DenLat() const
fst::VectorFst< LatticeArc > Lattice
int32 frames_per_sequence
DiscriminativeSupervision()
std::vector< int32 > state_times
SplitDiscriminativeSupervisionOptions()
bool remove_output_symbols
bool operator==(const LatticeWeightTpl< FloatType > &wa, const LatticeWeightTpl< FloatType > &wb)
fst::VectorFst< LatticeArc > Lattice