summaryrefslogtreecommitdiff
path: root/decoder/ff_wordalign.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2009-12-19 15:08:02 -0500
committerChris Dyer <redpony@gmail.com>2009-12-19 15:08:02 -0500
commit9be811a26da86b87bac8696f155188d9a675e61b (patch)
tree5c9e327fad80d666fe019623ab3fab8e34d6db04 /decoder/ff_wordalign.cc
parent27db9d8c05188f64c17d61c394d3dafe8b8e93d8 (diff)
few fixes
Diffstat (limited to 'decoder/ff_wordalign.cc')
-rw-r--r--decoder/ff_wordalign.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/decoder/ff_wordalign.cc b/decoder/ff_wordalign.cc
index f07eda02..c9f90541 100644
--- a/decoder/ff_wordalign.cc
+++ b/decoder/ff_wordalign.cc
@@ -144,6 +144,15 @@ SourcePOSBigram::SourcePOSBigram(const std::string& param) :
cerr << " (" << pos_.size() << " lines)\n";
}
+void SourcePOSBigram::FinalTraversalFeatures(const void* context,
+ SparseVector<double>* features) const {
+ WordID left = *static_cast<const WordID*>(context);
+ int left_wc = *(static_cast<const int*>(context) + 1);
+ if (left_wc == 1)
+ FireFeature(-1, left, features);
+ FireFeature(left, -1, features);
+}
+
void SourcePOSBigram::FireFeature(WordID left,
WordID right,
SparseVector<double>* features) const {
@@ -187,8 +196,6 @@ void SourcePOSBigram::TraversalFeaturesImpl(const SentenceMetadata& smeta,
FireFeature(-1, left, features);
FireFeature(left, right, features);
out_word_count = left_wc + right_wc;
- if (out_word_count == smeta.GetSourceLength())
- FireFeature(right, -1, features);
out_context = right;
}
}