pySBD icon indicating copy to clipboard operation
pySBD copied to clipboard

SyntaxError raised due to improper use of escape sequence "\s*"

Open diegodebrito opened this issue 10 months ago • 1 comments

I am getting a SyntaxError when debugging some code. The error is related to an invalid use with \ in the context of string matching (see link for exact line below).

re.finditer('{0}\s*'.format(re.escape(sent)), self.original_text)

Which raises the following error:

E     File "local\.venv\Lib\site-packages\pysbd\segmenter.py", line 66
E       for match in re.finditer('{0}\s*'.format(re.escape(sent)), self.original_text):
E                                ^^^^^^^^
E   SyntaxError: invalid escape sequence '\s'

https://github.com/nipunsadvilkar/pySBD/blob/5905f13be4fc95f407b98392e0ec303617a33d86/pysbd/segmenter.py#L66

diegodebrito avatar Dec 03 '24 21:12 diegodebrito