Files
PaddleOCR/tests
Ghazi-raad fa30849b01 fix: support accented characters in word segmentation for return_word… (#17201)
* fix: support accented characters in word segmentation for return_word_box

Fixes #17156

The word segmentation in get_word_info() was using [a-zA-Z0-9] regex which
only matched ASCII letters and digits. This caused words with accented
characters (ä, ö, ü, é, à, etc.) to be incorrectly split into separate
segments.

Changed to use \w with re.UNICODE flag which properly matches:
- All Unicode letter characters (including accented/diacritic characters)
- Digits from all scripts
- Excludes underscore (which \w includes but we want as splitter)

This fix enables proper word grouping for German, French, Polish, and
other languages with accented characters while maintaining backward
compatibility with existing ASCII text processing.

Example: 'Grüßen' now stays as one word instead of ['Gr', 'üß', 'en']

* fix: resolve pytest warning by using assert instead of return
2025-12-29 17:40:40 +08:00
..
2025-05-12 21:55:26 +08:00