Skip to content

Commit b312793

Browse files
authored
Merge pull request google#1144 from sanderland/patch-1
Thank you. merged.
2 parents d36cc77 + 5cea6d8 commit b312793

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/unigram_model_trainer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ std::vector<float> Trainer::RunEStep(const TrainerModel &model, float *obj,
341341
lattice.SetSentence(w);
342342
model.PopulateNodes(&lattice);
343343
const float Z = lattice.PopulateMarginal(freq, &expected[n]);
344-
ntokens[n] += lattice.Viterbi().first.size();
344+
ntokens[n] += lattice.Viterbi().first.size() * freq;
345345
CHECK(!std::isnan(Z))
346346
<< "likelihood is NAN. Input sentence may be too long";
347347
objs[n] -= Z / all_sentence_freq;

0 commit comments

Comments
 (0)