Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default text prep pipeline mishandles decomposed unicode chars #434

Open
serapio opened this issue Aug 11, 2022 · 0 comments
Open

Default text prep pipeline mishandles decomposed unicode chars #434

serapio opened this issue Aug 11, 2022 · 0 comments

Comments

@serapio
Copy link
Contributor

serapio commented Aug 11, 2022

The default text preparation pipeline does not do any unicode character normalization, while a few of the default normalizer regexes do not include the combining diacritics in the alphabetic/word-like ranges. As a result, the resulting tokens will be split at any character that uses a combining diacritic:

  • "réunion" => ["re", "union"] (decomposed input) vs "réunion" => ["reunion"] (composed input)
  • "reunión" => ["reunio", "n"] (decomposed input) vs "reunión" => ["reunion"] (composed input)
  • "für" => ["fu", "r"] (decomposed input) vs "für" => ["fur"] (composed input)

In addition, the ascii-folding filter ignores (i.e. copies) the combining diacritics, so if the developer specifies the diactritics as word-like chars in the config
"keep_special_chars": r"\@\[\]'\u0300-\u036f"
Then those diacritics will be retained in the tokens, while the composed characters will be folded to characters without diacritics.

So the only solution available to the developer is to create a custom preprocessor that handles the character normalization, which is a fair bit more overhead for something that should be easy, if not the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant