sfischer13/python-arpa

important parser error

huangruizhe opened this issue · 0 comments

'(\t(-?\\d+(\\.\\d+)?)([eE]-?\\d+)?)?$')

The regular expression has an error here. Consider the case where the line is:
-2.310726 maybe when 9.609759e-05
The exponent in the backoff weight is not correctly parsed -- the e-05 will be missed.

Wrt the correct version, there should be an extra bracket/group in the expression. Like this:
"(\t ( (-?\d+(\.\d+)?)([eE]-?\d+)? ) )?$"