summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-03-01 22:34:04 -0500
committerChris Dyer <cdyer@cs.cmu.edu>2011-03-01 22:34:04 -0500
commit965c26a8ce00a603e639a6609b5147256ab1a189 (patch)
tree15f08704ad5effdbf634db978b001499964cb134
parent800c63ea3154c5ccddece5555d58254f95ebe696 (diff)
handle start-of-sentence correctly
-rw-r--r--decoder/ff_klm.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/decoder/ff_klm.cc b/decoder/ff_klm.cc
index f262229b..9ba2cbaa 100644
--- a/decoder/ff_klm.cc
+++ b/decoder/ff_klm.cc
@@ -84,6 +84,7 @@ class KLanguageModelImpl {
if (cur_word == kSOS_) {
if (state.ValidLength() > 0) { p = -100; }
state = ngram_->BeginSentenceState();
+ context_complete = true;
} else {
const lm::ngram::State scopy(state);
p = ngram_->Score(scopy, cur_word, state);
@@ -111,6 +112,7 @@ class KLanguageModelImpl {
if (cur_word == kSOS_) {
if (state.ValidLength() > 0) p = -100;
state = ngram_->BeginSentenceState();
+ context_complete = true;
} else {
const lm::ngram::State scopy(state);
p = ngram_->Score(scopy, cur_word, state);