jgauthier commited on
Commit
8059baf
1 Parent(s): ea234b8

get_region_edges: fix edge case (ha) where empty initial regions cause the count to be off

Browse files
Files changed (1) hide show
  1. syntaxgym.py +3 -1
syntaxgym.py CHANGED
@@ -265,7 +265,9 @@ class SyntaxGym(evaluate.EvaluationModule):
265
  ret.append(idx)
266
 
267
  region_size = len(region_content)
268
- if region_content.strip() != "" and r_idx != 0 and not region_content.startswith(","):
 
 
269
  # Add joining space
270
  region_size += 1
271
 
 
265
  ret.append(idx)
266
 
267
  region_size = len(region_content)
268
+ # If this is not the first nonspace/nonpunct region, then it will
269
+ # be preceded by a joining space.
270
+ if region_content.strip() != "" and idx > 0 and not region_content.startswith(","):
271
  # Add joining space
272
  region_size += 1
273