diff options
author | Chris Dyer <redpony@gmail.com> | 2009-12-07 13:01:21 -0500 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2009-12-07 13:01:21 -0500 |
commit | 476d09e1df52cba0be8e5f50d52bf5f32795288f (patch) | |
tree | 849b10b690bcf762aeeabf114595862742a811ca /src/ff_csplit.cc | |
parent | ec7edcc7e398bdb040d810094b8416ad9f279d98 (diff) |
add support for generating pruned lattices when in compound splitting mode
Diffstat (limited to 'src/ff_csplit.cc')
-rw-r--r-- | src/ff_csplit.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ff_csplit.cc b/src/ff_csplit.cc index eb106047..cac4bb8e 100644 --- a/src/ff_csplit.cc +++ b/src/ff_csplit.cc @@ -19,6 +19,8 @@ using namespace std; struct BasicCSplitFeaturesImpl { BasicCSplitFeaturesImpl(const string& param) : word_count_(FD::Convert("WordCount")), + letters_sq_(FD::Convert("LettersSq")), + letters_sqrt_(FD::Convert("LettersSqrt")), in_dict_(FD::Convert("InDict")), short_(FD::Convert("Short")), long_(FD::Convert("Long")), @@ -53,6 +55,8 @@ struct BasicCSplitFeaturesImpl { SparseVector<double>* features) const; const int word_count_; + const int letters_sq_; + const int letters_sqrt_; const int in_dict_; const int short_; const int long_; @@ -75,6 +79,8 @@ void BasicCSplitFeaturesImpl::TraversalFeaturesImpl( const Hypergraph::Edge& edge, SparseVector<double>* features) const { features->set_value(word_count_, 1.0); + features->set_value(letters_sq_, (edge.j_ - edge.i_) * (edge.j_ - edge.i_)); + features->set_value(letters_sqrt_, sqrt(edge.j_ - edge.i_)); const WordID word = edge.rule_->e_[1]; const char* sword = TD::Convert(word); const int len = strlen(sword); |