Skip to content

Commit

Permalink
match uppercase non-english letters too
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Melo committed Nov 5, 2023
1 parent cf03441 commit 100a689
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser/AbbrMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const isCapitalized = (text: string) => {
if (!text || text.length === 0) {
return false;
}
return /^[A-Z]/.test(text);
return /^\p{Lu}/u.test(text);
};

const compareNoCaseSensitive = (a: string, b: string): boolean => {
Expand Down Expand Up @@ -120,7 +120,7 @@ export class AbbrMarker implements AbstractMarker {
// Example: `I` as a sentence boundary and `I` as an abbreviation
// > We make a good team, you and I. Did you see Albert I. Jones yesterday?
// Related: https://github.com/azu/sentence-splitter/pull/31
if (isCapitalized(prevWord) && /^[A-Z]\./.test(currentWord) && isCapitalized(nextWord)) {
if (isCapitalized(prevWord) && /^\p{Lu}\./u.test(currentWord) && isCapitalized(nextWord)) {
sourceCode.markContextRange([sourceCode.offset, sourceCode.offset + currentWord.length]);
} else if (isMatched && !isCapitalized(nextWord)) {
// Exception. This allows to write Capitalized word at next word
Expand Down

0 comments on commit 100a689

Please sign in to comment.