Skip to content

Commit 1ff668a

Browse files
csukuangfjdanpovey
authored andcommitted
[src,scripts] fix various typos and errors in comments (kaldi-asr#3454)
1 parent 662dc57 commit 1ff668a

File tree

78 files changed

+253
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+253
-254
lines changed

egs/wsj/s5/utils/apply_map.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
Usage: apply_map.pl [options] map <input >output
4646
options: [-f <field-range> ] [--permissive]
4747
This applies a map to some specified fields of some input text:
48-
For each line in the map file: the first field is the thing wae
48+
For each line in the map file: the first field is the thing we
4949
map from, and the remaining fields are the sequence we map it to.
5050
The -f (field-range) option says which fields of the input file the map
5151
map should apply to.

egs/wsj/s5/utils/int2sym.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88

99
if ($ARGV[0] eq "-f") {
10-
shift @ARGV;
11-
$field_spec = shift @ARGV;
10+
shift @ARGV;
11+
$field_spec = shift @ARGV;
1212
if ($field_spec =~ m/^\d+$/) {
1313
$field_begin = $field_spec - 1; $field_end = $field_spec - 1;
1414
}
15-
if ($field_spec =~ m/^(\d*)[-:](\d*)/) { # accept e.g. 1:10 as a courtesty (properly, 1-10)
15+
if ($field_spec =~ m/^(\d*)[-:](\d*)/) { # accept e.g. 1:10 as a courtesy (properly, 1-10)
1616
if ($1 ne "") {
1717
$field_begin = $1 - 1; # Change to zero-based indexing.
1818
}
@@ -21,12 +21,12 @@
2121
}
2222
}
2323
if (!defined $field_begin && !defined $field_end) {
24-
die "Bad argument to -f option: $field_spec";
24+
die "Bad argument to -f option: $field_spec";
2525
}
2626
}
2727
$symtab = shift @ARGV;
2828
if(!defined $symtab) {
29-
print STDERR "Usage: sym2int.pl [options] symtab [input] > output\n" .
29+
print STDERR "Usage: int2sym.pl [options] symtab [input] > output\n" .
3030
"options: [-f (<field>|<field_start>-<field-end>)]\n" .
3131
"e.g.: -f 2, or -f 3-4\n";
3232
exit(1);

egs/wsj/s5/utils/prepare_lang.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ fi
269269
270270
# add_lex_disambig.pl is responsible for adding disambiguation symbols to
271271
# the lexicon, for telling us how many disambiguation symbols it used,
272-
# and and also for modifying the unknown-word's pronunciation (if the
272+
# and also for modifying the unknown-word's pronunciation (if the
273273
# --unk-fst was provided) to the sequence "#1 #2 #3", and reserving those
274274
# disambig symbols for that purpose.
275275
# The #2 will later be replaced with the actual unk model. The reason

egs/wsj/s5/utils/sym2int.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
for($x = 0; $x < 2; $x++) {
2121
if ($ARGV[0] eq "--map-oov") {
22-
shift @ARGV;
22+
shift @ARGV;
2323
$map_oov = shift @ARGV;
2424
if ($map_oov eq "-f" || $map_oov =~ m/words\.txt$/ || $map_oov eq "") {
2525
# disallow '-f', the empty string and anything ending in words.txt as the
@@ -29,11 +29,11 @@
2929
}
3030
if ($ARGV[0] eq "-f") {
3131
shift @ARGV;
32-
$field_spec = shift @ARGV;
32+
$field_spec = shift @ARGV;
3333
if ($field_spec =~ m/^\d+$/) {
3434
$field_begin = $field_spec - 1; $field_end = $field_spec - 1;
3535
}
36-
if ($field_spec =~ m/^(\d*)[-:](\d*)/) { # accept e.g. 1:10 as a courtesty (properly, 1-10)
36+
if ($field_spec =~ m/^(\d*)[-:](\d*)/) { # accept e.g. 1:10 as a courtesy (properly, 1-10)
3737
if ($1 ne "") {
3838
$field_begin = $1 - 1; # Change to zero-based indexing.
3939
}
@@ -42,7 +42,7 @@
4242
}
4343
}
4444
if (!defined $field_begin && !defined $field_end) {
45-
die "Bad argument to -f option: $field_spec";
45+
die "Bad argument to -f option: $field_spec";
4646
}
4747
}
4848
}
@@ -98,7 +98,7 @@
9898
print "\n";
9999
}
100100
if ($num_warning > 0) {
101-
print STDERR "** Replaced $num_warning instances of OOVs with $map_oov\n";
101+
print STDERR "** Replaced $num_warning instances of OOVs with $map_oov\n";
102102
}
103103

104104
exit(0);

src/base/kaldi-math.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int32 RandInt(int32 min_val, int32 max_val, struct RandomState* state) {
121121
}
122122

123123
// Returns poisson-distributed random number.
124-
// Take care: this takes time proportinal
124+
// Take care: this takes time proportional
125125
// to lambda. Faster algorithms exist but are more complex.
126126
int32 RandPoisson(float lambda, struct RandomState* state) {
127127
// Knuth's algorithm.

src/base/kaldi-math.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ inline Float RandPrune(Float post, BaseFloat prune_thresh,
180180
(RandUniform(state) <= fabs(post)/prune_thresh ? prune_thresh : 0.0);
181181
}
182182

183-
183+
// returns log(exp(x) + exp(y)).
184184
inline double LogAdd(double x, double y) {
185185
double diff;
186186

@@ -202,6 +202,7 @@ inline double LogAdd(double x, double y) {
202202
}
203203

204204

205+
// returns log(exp(x) + exp(y)).
205206
inline float LogAdd(float x, float y) {
206207
float diff;
207208

@@ -223,7 +224,7 @@ inline float LogAdd(float x, float y) {
223224
}
224225

225226

226-
// returns exp(x) - exp(y).
227+
// returns log(exp(x) - exp(y)).
227228
inline double LogSub(double x, double y) {
228229
if (y >= x) { // Throws exception if y>=x.
229230
if (y == x)
@@ -242,7 +243,7 @@ inline double LogSub(double x, double y) {
242243
}
243244

244245

245-
// returns exp(x) - exp(y).
246+
// returns log(exp(x) - exp(y)).
246247
inline float LogSub(float x, float y) {
247248
if (y >= x) { // Throws exception if y>=x.
248249
if (y == x)

src/decoder/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ LIBNAME = kaldi-decoder
1414
ADDLIBS = ../lat/kaldi-lat.a ../fstext/kaldi-fstext.a ../hmm/kaldi-hmm.a \
1515
../transform/kaldi-transform.a ../gmm/kaldi-gmm.a \
1616
../tree/kaldi-tree.a ../util/kaldi-util.a ../matrix/kaldi-matrix.a \
17-
../base/kaldi-base.a
17+
../base/kaldi-base.a
1818

1919
include ../makefiles/default_rules.mk

src/decoder/decodable-mapped.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ class DecodableMapped: public DecodableInterface {
4444
KALDI_ASSERT(static_cast<size_t>(state_index) < index_map_.size());
4545
return decodable_->LogLikelihood(frame, index_map_[state_index]);
4646
}
47-
47+
4848
// note: indices are assumed to be numbered from one, so
4949
// NumIndices() will be the same as the largest index.
5050
virtual int32 NumIndices() const { return static_cast<int32>(index_map_.size()) - 1; }
51-
51+
5252
virtual bool IsLastFrame(int32 frame) const {
5353
// We require all the decodables have the same #frames. We don't check this though.
5454
return decodable_->IsLastFrame(frame);
55-
}
55+
}
5656

5757
private:
5858
std::vector<int32> index_map_;
5959
DecodableInterface *decodable_;
60-
60+
6161
KALDI_DISALLOW_COPY_AND_ASSIGN(DecodableMapped);
6262
};
6363

src/decoder/decodable-matrix.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,8 @@ class DecodableMatrixMappedOffset: public DecodableInterface {
154154
DecodableMatrixMappedOffset(const TransitionModel &tm):
155155
trans_model_(tm), frame_offset_(0), input_is_finished_(false) { }
156156

157-
virtual int32 NumFramesReady() { return frame_offset_ + loglikes_.NumRows(); }
158-
159157
// this is not part of the generic Decodable interface.
160-
int32 FirstAvailableFrame() { return frame_offset_; }
158+
int32 FirstAvailableFrame() const { return frame_offset_; }
161159

162160
// Logically, this function appends 'loglikes' (interpreted as newly available
163161
// frames) to the log-likelihoods stored in the class.

src/decoder/decodable-sum.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class DecodableSum: public DecodableInterface {
4949
const std::vector<std::pair<DecodableInterface*, BaseFloat> > &decodables) :
5050
decodables_(decodables) { CheckSizes(); }
5151

52-
void CheckSizes() {
52+
void CheckSizes() const {
5353
KALDI_ASSERT(decodables_.size() >= 1
5454
&& decodables_[0].first != NULL);
5555
for (size_t i = 1; i < decodables_.size(); i++)
@@ -67,10 +67,6 @@ class DecodableSum: public DecodableInterface {
6767
iter != decodables_.end();
6868
++iter) {
6969
sum += iter->first->LogLikelihood(frame, state_index) * iter->second;
70-
// BaseFloat tmp = iter->first->LogLikelihood(frame, state_index);
71-
// KALDI_LOG << "ITEM " << i << " contributed with loglike=" << tmp << " scaled by=" << iter->second;
72-
// i+=1;
73-
// sum += tmp * iter->second;
7470
}
7571
return sum;
7672
}

0 commit comments

Comments
 (0)