Repository navigation
Minor: Reuse the runtime email scan in the spellcheck URL guard - #1360
Conversation
|
Made a few cosmetic edits, details below. Changes:
detailed generated AI validated by me:
|
mawiesne
left a comment
There was a problem hiding this comment.
Thx for the PR. Changes lgtm. Just one minor editorial edit in the comment.
| } | ||
|
|
||
| /** | ||
| * Tests whether a whole text is one email address. |
There was a problem hiding this comment.
"Tests" should read "Checks" here.
| () -> new SpellCheckingCharSequenceNormalizer((SymSpell) null)); | ||
| } | ||
| private boolean numberLike(String core) { | ||
| return new SpellCheckingCharSequenceNormalizer(symSpell).isNumberLike(core); |
MailAddressScan in opennlp-runtime is now public @internal with isAddress. SpellCheckingCharSequenceNormalizer replaces its URL_LIKE regex with a cursor scan that uses MailAddressScan.isAddress for the email branch.
… test isNumberLike compares against the DOT and a new COMMA constant instead of literals, the MailAddressScan @throws reads "Thrown if", and the normalizer test builds one SpellCheckingCharSequenceNormalizer in setUp instead of one per call in the generated-token loops. The test uses the imported Pattern and one literal for the emoji token. Signed-off-by: Kristian Rickert <kristian@apache.org>
|
Addressed your comments. Thx @mawiesne |
8a6e636 to
554f60b
Compare
Makes the runtime MailAddressScan @internal public and replaces the URL_LIKE regex in SpellCheckingCharSequenceNormalizer with a cursor scan that reuses it for the email branch. A differential test checks the new scan against the old pattern.