Skip to content

Commit 5c6a5bc

Browse files
authored
[src] Fixes to comments in chain-denominator.{h,cc} (kaldi-asr#3985)
1 parent 5fb174e commit 5c6a5bc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/chain/chain-den-graph.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void DenominatorGraph::SetInitialProbs(const fst::StdVectorFst &fst) {
132132
}
133133
cur_prob.Swap(&next_prob);
134134
next_prob.SetZero();
135-
// Renormalize, beause the HMM won't sum to one even after the
135+
// Renormalize, because the HMM won't sum to one even after the
136136
// previous normalization (due to final-probs).
137137
cur_prob.Scale(1.0 / cur_prob.Sum());
138138
}
@@ -181,7 +181,7 @@ void MapFstToPdfIdsPlusOne(const TransitionModel &trans_model,
181181

182182
void MinimizeAcceptorNoPush(fst::StdVectorFst *fst) {
183183
BaseFloat delta = fst::kDelta * 10.0; // use fairly loose delta for
184-
// aggressive minimimization.
184+
// aggressive minimization.
185185
fst::ArcMap(fst, fst::QuantizeMapper<fst::StdArc>(delta));
186186
fst::EncodeMapper<fst::StdArc> encoder(fst::kEncodeLabels | fst::kEncodeWeights,
187187
fst::ENCODE);
@@ -314,7 +314,7 @@ void CreateDenominatorFst(const ContextDependency &ctx_dep,
314314
AddSubsequentialLoop(subsequential_symbol, &phone_lm);
315315
fst::Project(&phone_lm, fst::PROJECT_INPUT);
316316
}
317-
std::vector<int32> disambig_syms; // empty list of diambiguation symbols.
317+
std::vector<int32> disambig_syms; // empty list of disambiguation symbols.
318318

319319
// inv_cfst will be expanded on the fly, as needed.
320320
fst::InverseContextFst inv_cfst(subsequential_symbol,

src/chain/chain-den-graph.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class DenominatorGraph {
6363
DenominatorGraph();
6464

6565
// Initialize from epsilon-free acceptor FST with pdf-ids plus one as the
66-
// labels. 'num_pdfs' is only needeed for checking.
66+
// labels. 'num_pdfs' is only needed for checking.
6767
DenominatorGraph(const fst::StdVectorFst &fst,
6868
int32 num_pdfs);
6969

@@ -88,7 +88,7 @@ class DenominatorGraph {
8888
// Note: we renormalize each HMM-state to sum to one before doing this.
8989
const CuVector<BaseFloat> &InitialProbs() const;
9090

91-
// This function outputs a modifified version of the FST that was used to
91+
// This function outputs a modified version of the FST that was used to
9292
// build this object, that has an initial-state with epsilon transitions to
9393
// each state, with weight determined by initial_probs_; and has each original
9494
// state being final with probability one (note: we remove epsilons). This is
@@ -124,7 +124,7 @@ class DenominatorGraph {
124124
CuArray<Int32Pair> forward_transitions_;
125125
// backward_transitions_ is an array, indexed by hmm-state index,
126126
// of start and end indexes into the transition_ array, which
127-
// give us the set of transitions out of this state.
127+
// give us the set of transitions into this state.
128128
CuArray<Int32Pair> backward_transitions_;
129129
// This stores the actual transitions.
130130
CuArray<DenominatorGraphTransition> transitions_;
@@ -153,7 +153,7 @@ void MapFstToPdfIdsPlusOne(const TransitionModel &trans_model,
153153
fst::StdVectorFst *fst);
154154

155155
// Starting from an acceptor on phones that represents some kind of compiled
156-
// language model (with no disambiguation symbols), this funtion creates the
156+
// language model (with no disambiguation symbols), this function creates the
157157
// denominator-graph. Note: there is similar code in chain-supervision.cc, when
158158
// creating the supervision graph.
159159
void CreateDenominatorFst(const ContextDependency &ctx_dep,

src/chain/chain-denominator.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ namespace chain {
6666
6767
* Forward computation (version 1)
6868
69-
In the forward computation we're computing alpha(i, t) for 0 <= t <= T):
69+
In the forward computation we're computing alpha(t, i) for 0 <= t <= T):
7070
- For the first frame, set alpha(0, i) = init(i), where init(i) is the
71-
initial-probabilitiy from state i. # in our framework these are obtained
71+
initial-probability from state i. # in our framework these are obtained
7272
# by running the HMM for a while and getting an averaged occupation
7373
# probability, and using this as an initial-prob, since the boundaries of
7474
# chunks don't really correspond to utterance boundaries in general.]
@@ -161,7 +161,7 @@ namespace chain {
161161
- total-prob = \sum_i alpha'(T, i)
162162
163163
The corrected log-prob that we return from the algorithm will be
164-
(total-prob + \sum_{t=0}^{T-1} \log tot-alpha(t)).
164+
(\log(total-prob) + \sum_{t=0}^{T-1} \log tot-alpha(t)).
165165
166166
* Backward computation (version 3)
167167

0 commit comments

Comments
 (0)