ufal/korektor

Parenthesis in data causes regex error in evaluation script

loganathanspr opened this issue · 0 comments

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