From a0f8f3a5c8205a63f7b89e1431699c205843d86a Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Sun, 6 Mar 2011 17:10:13 -0500 Subject: support feature collapsing with new span features --- decoder/ff_spans.cc | 8 ++++---- decoder/ff_spans.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/decoder/ff_spans.cc b/decoder/ff_spans.cc index 17e1d650..89335682 100644 --- a/decoder/ff_spans.cc +++ b/decoder/ff_spans.cc @@ -151,8 +151,8 @@ void SpanFeatures::PrepareForInput(const SentenceMetadata& smeta) { bfid << "BS:" << TD::Convert(bword); beg_span_ids_[i] = FD::Convert(bfid.str()); if (use_collapsed_features_) { - end_span_vals_[i] = feat2val_[sfid.str()]; - beg_span_vals_[i] = feat2val_[bfid.str()]; + end_span_vals_[i] = feat2val_[sfid.str()] + feat2val_[esbiid.str()]; + beg_span_vals_[i] = feat2val_[bfid.str()] + feat2val_[bsbiid.str()]; } } for (int i = 0; i <= lattice.size(); ++i) { @@ -175,8 +175,8 @@ void SpanFeatures::PrepareForInput(const SentenceMetadata& smeta) { len_span_feats_(i,j).first = FD::Convert(lf.str()); len_span_feats_(i,j).second = FD::Convert("S_" + lf.str()); if (use_collapsed_features_) { - span_vals_(i,j).first = feat2val_[pf.str()]; - span_vals_(i,j).second = feat2val_["S_" + pf.str()]; + span_vals_(i,j).first = feat2val_[pf.str()] + feat2val_[lf.str()]; + span_vals_(i,j).second = feat2val_["S_" + pf.str()] + feat2val_["S_" + lf.str()]; } } } diff --git a/decoder/ff_spans.h b/decoder/ff_spans.h index 67269d26..24e0dede 100644 --- a/decoder/ff_spans.h +++ b/decoder/ff_spans.h @@ -38,9 +38,7 @@ class SpanFeatures : public FeatureFunction { int fid_span_; std::map feat2val_; std::vector end_span_vals_; - std::vector end_bigram_vals_; std::vector beg_span_vals_; - std::vector beg_bigram_vals_; Array2D > span_vals_; WordID oov_; -- cgit v1.2.3