summaryrefslogtreecommitdiff
path: root/rst_parser
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-04-18 22:34:57 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-04-18 22:34:57 -0400
commita4e62df53b4bbac77cb967997dae41fb8dc674d7 (patch)
treeda41a9628afab398d54024a1f11f1d0c282a498e /rst_parser
parent206a30b912b2c425379ef23dbe0d8a61d3dea913 (diff)
damn off by one error
Diffstat (limited to 'rst_parser')
-rw-r--r--rst_parser/arc_ff.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/rst_parser/arc_ff.cc b/rst_parser/arc_ff.cc
index b3560b73..673648d1 100644
--- a/rst_parser/arc_ff.cc
+++ b/rst_parser/arc_ff.cc
@@ -75,7 +75,8 @@ 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 string dir = (m < h ? "MLeft" : "MRight");
+ const bool bdir = m < h;
+ const string dir = (bdir ? "MLeft" : "MRight");
int v = m - h;
if (v < 0) {
v= -1 - int(log(-v) / log(2));
@@ -119,7 +120,7 @@ struct ArcFFImpl {
int left = min(h,m);
int right = max(h,m);
if (right - left >= 2) {
- --right;
+ if (bdir) --right; else ++left;
for (map<WordID, vector<int> >::const_iterator it = pcs.begin(); it != pcs.end(); ++it) {
if (it->second[left] != it->second[right]) {
Fire(features, "BT", head_pos, TD::Convert(it->first), mod_pos);