Spaces:
Sleeping
Sleeping
get_region_edges: fix edge case (ha) where empty initial regions cause the count to be off
Browse files- 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 |
-
|
|
|
|
|
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 |
|