summaryrefslogtreecommitdiff
path: root/klm/lm/model.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-11-07 18:10:00 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2011-11-07 18:10:00 -0500
commit70c65e2a4df480f16a5f43de71024c4f36659b8e (patch)
tree7807b86743760c7c1c78e066ddf26ed91cbd6d3d /klm/lm/model.cc
parent9ed514b2d10c9507a8399623306582da45b78800 (diff)
parent9b9d565a9300b3a2b80bbb952bbf88dd36860ce2 (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'klm/lm/model.cc')
-rw-r--r--klm/lm/model.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/klm/lm/model.cc b/klm/lm/model.cc
index 25f1ab7c..e4c1ec1d 100644
--- a/klm/lm/model.cc
+++ b/klm/lm/model.cc
@@ -91,8 +91,8 @@ template <class Search, class VocabularyT> void GenericModel<Search, VocabularyT
template <class Search, class VocabularyT> FullScoreReturn GenericModel<Search, VocabularyT>::FullScore(const State &in_state, const WordIndex new_word, State &out_state) const {
FullScoreReturn ret = ScoreExceptBackoff(in_state.words, in_state.words + in_state.length, new_word, out_state);
- if (ret.ngram_length - 1 < in_state.length) {
- ret.prob = std::accumulate(in_state.backoff + ret.ngram_length - 1, in_state.backoff + in_state.length, ret.prob);
+ for (const float *i = in_state.backoff + ret.ngram_length - 1; i < in_state.backoff + in_state.length; ++i) {
+ ret.prob += *i;
}
return ret;
}