summaryrefslogtreecommitdiff
path: root/decoder/ff_tagger.cc
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-03-29 23:05:40 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2011-03-29 23:05:40 -0400
commitcf192109de3919e6e53d21c516531aa0d1018b5e (patch)
treea99f8bac42376f7fd926a3ce8c966b8dcbaa0e81 /decoder/ff_tagger.cc
parentfc17a75cefc5d7b069a5605cb2176f7ee3ef8649 (diff)
dynasearch neighborhood option instead of default partition
Diffstat (limited to 'decoder/ff_tagger.cc')
-rw-r--r--decoder/ff_tagger.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/decoder/ff_tagger.cc b/decoder/ff_tagger.cc
index 46c85cf3..019315a2 100644
--- a/decoder/ff_tagger.cc
+++ b/decoder/ff_tagger.cc
@@ -9,11 +9,14 @@
using namespace std;
Tagger_BigramIndicator::Tagger_BigramIndicator(const std::string& param) :
- FeatureFunction(sizeof(WordID)) {}
+ FeatureFunction(sizeof(WordID)) {
+ no_uni_ = (LowercaseString(param) == "no_uni");
+}
void Tagger_BigramIndicator::FireFeature(const WordID& left,
const WordID& right,
SparseVector<double>* features) const {
+ if (no_uni_ && right == 0) return;
int& fid = fmap_[left][right];
if (!fid) {
ostringstream os;
@@ -41,6 +44,8 @@ void Tagger_BigramIndicator::TraversalFeaturesImpl(const SentenceMetadata& smeta
if (arity == 0) {
out_context = edge.rule_->e_[0];
FireFeature(out_context, 0, features);
+ } else if (arity == 1) {
+ out_context = *static_cast<const WordID*>(ant_contexts[0]);
} else if (arity == 2) {
WordID left = *static_cast<const WordID*>(ant_contexts[0]);
WordID right = *static_cast<const WordID*>(ant_contexts[1]);
@@ -50,6 +55,8 @@ void Tagger_BigramIndicator::TraversalFeaturesImpl(const SentenceMetadata& smeta
if (edge.i_ == 0 && edge.j_ == smeta.GetSourceLength())
FireFeature(right, -1, features);
out_context = right;
+ } else {
+ assert(!"shouldn't happen");
}
}