FoodDesert commited on
Commit
5b174ea
1 Parent(s): f1da0db

Upload app.py

Browse files

Fixing a bug so that multiple "Move Comma Inside Parentheses" can be captured.

Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -538,11 +538,10 @@ def augment_bad_entities_with_regex(text):
538
  index = match.start(1)
539
  bad_entities.append({"entity":"Remove Final Comma", "start":index, "end":index+1})
540
 
541
- #comma after parentheses
542
- match = re.search(r'\)\s*(,)\s*[^\s]',text)
543
- if match:
544
  index = match.start(1)
545
- bad_entities.append({"entity":"Move Comma Inside Parentheses", "start":index, "end":index+1})
546
 
547
  return bad_entities
548
 
 
538
  index = match.start(1)
539
  bad_entities.append({"entity":"Remove Final Comma", "start":index, "end":index+1})
540
 
541
+ # Comma after parentheses, multiple occurrences
542
+ for match in re.finditer(r'\)\s*(,)\s*[^\s]', text):
 
543
  index = match.start(1)
544
+ bad_entities.append({"entity": "Move Comma Inside Parentheses", "start": index, "end": index + 1})
545
 
546
  return bad_entities
547