From d4e9d2678903d92115f981097debf305876b7180 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Wed, 18 Apr 2012 03:21:39 -0400 Subject: arc ff fix --- rst_parser/arc_ff.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'rst_parser') diff --git a/rst_parser/arc_ff.cc b/rst_parser/arc_ff.cc index 2992cde2..b3560b73 100644 --- a/rst_parser/arc_ff.cc +++ b/rst_parser/arc_ff.cc @@ -38,28 +38,28 @@ struct ArcFFImpl { template static void Fire(SparseVector* v, const A& a, const B& b) { ostringstream os; - os << a << '_' << b; + os << a << ':' << b; v->set_value(FD::Convert(os.str()), 1); } template static void Fire(SparseVector* v, const A& a, const B& b, const C& c) { ostringstream os; - os << a << '_' << b << '_' << c; + os << a << ':' << b << '_' << c; v->set_value(FD::Convert(os.str()), 1); } template static void Fire(SparseVector* v, const A& a, const B& b, const C& c, const D& d) { ostringstream os; - os << a << '_' << b << '_' << c << '_' << d; + os << a << ':' << b << '_' << c << '_' << d; v->set_value(FD::Convert(os.str()), 1); } template static void Fire(SparseVector* v, const A& a, const B& b, const C& c, const D& d, const E& e) { ostringstream os; - os << a << '_' << b << '_' << c << '_' << d << '_' << e; + os << a << ':' << b << '_' << c << '_' << d << '_' << e; v->set_value(FD::Convert(os.str()), 1); } @@ -75,7 +75,7 @@ struct ArcFFImpl { const string& mod_pos = TD::Convert(sent.pos[m]); const string& mod_pos_L = (m > 0 ? TD::Convert(sent.pos[m-1]) : kLEFT_POS); const string& mod_pos_R = (m < sent.pos.size() - 1 ? TD::Convert(sent.pos[m]) : kRIGHT_POS); - const bool dir = m < h; + const string dir = (m < h ? "MLeft" : "MRight"); int v = m - h; if (v < 0) { v= -1 - int(log(-v) / log(2)); @@ -118,11 +118,13 @@ struct ArcFFImpl { // between features int left = min(h,m); int right = max(h,m); - if (right - left > 2) { - ++left; + if (right - left >= 2) { + --right; for (map >::const_iterator it = pcs.begin(); it != pcs.end(); ++it) { - if (it->second[left] != it->second[right]) + if (it->second[left] != it->second[right]) { Fire(features, "BT", head_pos, TD::Convert(it->first), mod_pos); + Fire(features, "BT", head_pos, TD::Convert(it->first), mod_pos, dir); + } } } } -- cgit v1.2.3