krickert commented on code in PR #1151:
URL: https://github.com/apache/opennlp/pull/1151#discussion_r3594018134
##########
opennlp-core/opennlp-runtime/src/main/java/opennlp/tools/util/normalizer/UrlCharSequenceNormalizer.java:
##########
@@ -16,29 +16,201 @@
*/
package opennlp.tools.util.normalizer;
-import java.util.regex.Pattern;
-
/**
- * A {@link UrlCharSequenceNormalizer} implementation that normalizes text
+ * A {@link CharSequenceNormalizer} implementation that normalizes text
* in terms of URls and email addresses. Every encounter will be replaced by a
whitespace.
+ *
+ * <p>Normalization runs in two passes:</p>
+ * <ol>
+ * <li>URLs: a lowercase {@code http://} or {@code https://} scheme followed
by at least one
+ * character out of the body set {@code [-_.?&~;+=/#0-9A-Za-z]} becomes
one space; the
+ * match ends at the first character outside that set, so a colon
(port), a percent
+ * escape, an at sign (userinfo), or a non-ASCII label cuts it
short.</li>
+ * <li>Email addresses: a maximal run of the local-part set {@code
[-+_.0-9A-Za-z]} whose
+ * left neighbor is outside that set, an {@code @}, and a domain run out
of
+ * {@code [-.0-9A-Za-z]} that must not start with a dot and must span at
least two
+ * chars, become one space.</li>
+ * </ol>
*/
public class UrlCharSequenceNormalizer implements CharSequenceNormalizer {
private static final long serialVersionUID = 2023145028634552389L;
Review Comment:
Same.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]