ufal / korektor

Statistical spell- and (occasional) grammar-checker.
lindat.mff.cuni.cz/services/korektor
BSD 2-Clause "Simplified" License
17 stars 4 forks source link

Parenthesis in data causes regex error in evaluation script #15

Closed loganathanspr closed 9 years ago

loganathanspr commented 9 years ago

When regex patterns are read from file, if the data contains patterns such as this grammarsuggestions=". x : , )">x</grammar causes the following error

    out_line = re.sub(sugg_pat_orig, sugg_pat_new, out_line, count=1)
  File "/usr/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib/python2.7/re.py", line 244, in _compile
    raise error, v # invalid expression
sre_constants.error: unbalanced parenthesis