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 | f4a96ee777d7d250cc51a32e8374548de235df18 (patch) | |
tree | f744c963e0e8fbdc580b328dd8b61f820206df06 /decoder | |
parent | 8cc05e205fd21c18e2091255413b96fc412e3ef8 (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_; |