Fix particle rules falsely lowercasing apostrophe names#17
Open
shrinathaithal wants to merge 2 commits into
Open
Fix particle rules falsely lowercasing apostrophe names#17shrinathaithal wants to merge 2 commits into
shrinathaithal wants to merge 2 commits into
Conversation
Particle prefix rules (La, Le, Von, De, etc.) used \b which matches at apostrophes, incorrectly lowercasing names like La'Shea to la'Shea, Da'Quan to da'Quan, and Le'Andre to le'Andre. Changed 9 rules to use (?=\s+\w) lookahead — matching the pattern already used by Al, Ben, and Van rules. Particles only function as particles when followed by a space and a surname, not before an apostrophe.
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.
Problem
Particle prefix rules (
La,Le,Von,De,El,Ap,Bin,Dell[ae],D[aeiou'],D[ao]s,De[lr]) use\bword boundary anchors, which match at apostrophes. This causes names likeLa'Shea,Da'Quan, andLe'Andreto be incorrectly lowercased:The
Al,Ben, andVanrules already avoid this by using(?=\s+\w)lookahead instead of\b.Fix
Changed the remaining 9 particle rules to use
(?=\s+\w), consistent with the existing pattern. Particles only function as particles when followed by a space and a surname — not before an apostrophe.Before / After
la'sheala'SheaLa'Sheada'quanda'QuanDa'Quanle'andrele'AndreLe'Andrela poissonla Poissonla Poissonvon braunvon Braunvon Braundel cronddel Cronddel CrondAll existing tests pass. Added test cases for apostrophe names.