diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-03-06 17:10:13 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-03-06 17:10:13 -0500 |
commit | a0f8f3a5c8205a63f7b89e1431699c205843d86a (patch) | |
tree | 2e485d7636fc68b1137267171861a526b165be49 /decoder | |
parent | b4fe74257d0eb02b760fc59a7aeb65a34895abd1 (diff) |
support feature collapsing with new span features
Diffstat (limited to 'decoder')
-rw-r--r-- | decoder/ff_spans.cc | 8 | ||||
-rw-r--r-- | 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<std::string, double> feat2val_; std::vector<double> end_span_vals_; - std::vector<double> end_bigram_vals_; std::vector<double> beg_span_vals_; - std::vector<double> beg_bigram_vals_; Array2D<std::pair<double,double> > span_vals_; WordID oov_; |