Repository navigation
OPENNLP-1946: UrlCharSequenceNormalizer removes whole URLs including ports, userinfo and non-ASCII hosts - #1315
Merged
Merged
Conversation
Contributor
Author
rzo1
force-pushed
the
OPENNLP-1946-url-normalizer
branch
from
September 18, 2026 13:29
b894023 to
62fd146
Compare
…and document the limits of the default The default normalizer and the language detector chain are unchanged, and the class Javadoc states the limits found with the WHATWG URL test data. The new class removes http and https URLs with ports, userinfo, percent escapes, IPv6 hosts and non-ASCII paths, bounded by whitespace and delimiters, with a left boundary before the scheme, in linear time. The manual describes both and how to opt in.
…e earlier output as LEGACY UrlCharSequenceNormalizer now removes each http or https URL as a whole, including a port, userinfo, percent escapes, a bracketed IPv6 host and non-ASCII hosts and paths, and gives back trailing punctuation, a trailing apostrophe and unbalanced closing brackets. Under CompatibilityMode.LEGACY it produces the earlier output for language detector models trained with it. BoundedUrlCharSequenceNormalizer is removed; its rules and tests move to the default. The ASCII letter and digit set moves to AsciiChars, and the scheme check uses StringUtil.isAsciiLetter.
rzo1
force-pushed
the
OPENNLP-1946-url-normalizer
branch
from
September 18, 2026 17:07
62fd146 to
3a40854
Compare
rzo1
marked this pull request as ready for review
September 18, 2026 17:10
Contributor
EVAL build run: |
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.
Replaces #1295, reworked as discussed in the review there. Kristian's commit is kept as the first commit. Based on main, which has
StringUtil.isAsciiLettersince #1311.What changes
UrlCharSequenceNormalizeris fixed in place instead of getting a separate opt-in class:httporhttpsURL (any letter case, with a left boundary) is removed as a whole, up to the next Unicode whitespace, control character, unpaired surrogate, typographic quote or< > ". Ports, userinfo, percent escapes, bracketed IPv6 hosts and non-ASCII hosts and paths are included.. , ; : ! ?, a trailing apostrophe and closing brackets without their opening bracket are given back:(http://example.com/a).gives( ).,'http://example.com/a'gives' '.git+https://,telnet://,redis://, ...) are kept, and no email address is matched inside them.-Dopennlp.compat.mode=LEGACY(OPENNLP-1973: Regex removal (prep): Add a CompatibilityMode switch for the earlier output #1312) the earlier output is produced, for language detector models trained with it. The existing characterization test against the former regexes now runs underLEGACY.BoundedUrlCharSequenceNormalizeris removed; its rules and its tests move to the default. The ASCII letter/digit set moves fromMailAddressScantoAsciiChars, and the scheme check usesStringUtil.isAsciiLetter. The manual row in the language detector chapter describes the new output and theLEGACYswitch; the opt-in section is gone.Before merge
Commits by @krickert (#1295) and @rzo1.
OPENNLP-1946