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

Better French book abbreviation handling #606

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

jwinston-bn
Copy link
Contributor

No description provided.

…fter book abbreviation, and enforce always putting a space between abbreviation and number (rather than sometimes a nnbsp).
"jud" or "ju" => "Jd",
"re" or "rév" or "rev" => "Ap",
_ => m.Value
var correctedValue = m.Value.Trim().Replace(".", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does French not use periods for abbreviations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want any periods after the abbreviation, just a space. Sometimes the AI would put one and then my replacement logic wouldn't pick it up. So now the regex will pick up a period that's directly after the book name as well (e.g. "Ex. 32.17–18" would match "Ex. " whereas before it wouldn't have matched).

});

return Task.FromResult(text);
}

[GeneratedRegex(@"(?:\d+[^\S\r\n])?([a-zA-Zà-üÀ-Ü]+)(?=[^\S\r\n|\.]\d+)")]
[GeneratedRegex(@"(?:\d+[^\S\r\n])?([a-zA-Zà-üÀ-Ü]+\.?[^\S\r\n]?)(?=[^\S\r\n]?\d+)")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main difference here is that this now captures the period if present?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matches a period as well as any whitespace. So if it separates the book and verse by a non breaking space I can replace it with a regular space.

@jwinston-bn jwinston-bn merged commit adfe69a into master Dec 16, 2024
1 check passed
@jwinston-bn jwinston-bn deleted the french-post-processing-fix branch December 16, 2024 17:37
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

Successfully merging this pull request may close these issues.

2 participants