Improve word splitting for string normalization#113
Merged
Conversation
vkatsuba
approved these changes
Nov 13, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the word splitting logic in string normalization to better handle various Unicode space and control characters. The changes refactor separator detection into three distinct macros and enhance the normalize_words functions to properly handle characters that should be ignored versus those that should split or be mapped to spaces.
Key changes:
- Introduces three new character classification macros:
is_sep,is_map_space, andis_word_ignore_charfor more granular control over character handling - Updates
normalize_words_wordandnormalize_words_sepfunctions to use the new macros for improved word boundary detection - Adds test coverage for multi-word normalization scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/z_string_normalize.erl | Refactors character classification into dedicated macros and updates word splitting logic to handle separators, space-like characters, and ignorable characters distinctly |
| test/z_string_test.erl | Renames existing single-word test and adds new multi-word normalization test case to verify improved word splitting behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.