Package opennlp.tools.util.normalizer
Class UrlCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.UrlCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,opennlp.tools.util.normalizer.CharSequenceNormalizer
public class UrlCharSequenceNormalizer
extends Object
implements opennlp.tools.util.normalizer.CharSequenceNormalizer
A
CharSequenceNormalizer implementation that normalizes text
in terms of URls and email addresses. Every encounter will be replaced by a whitespace.
Normalization runs in two passes:
- URLs: a lowercase
http://orhttps://scheme followed by at least one character out of the body set[-_.?&~;+=/#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. - Email addresses: a maximal run of the local-part set
[-+_.0-9A-Za-z]whose left neighbor is outside that set, an@, and a domain run out of[-.0-9A-Za-z]that must not start with a dot and must span at least two chars, become one space.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic UrlCharSequenceNormalizerReturns the shared, stateless instance.normalize(CharSequence text)
-
Constructor Details
-
UrlCharSequenceNormalizer
public UrlCharSequenceNormalizer()
-
-
Method Details
-
getInstance
Returns the shared, stateless instance.- Returns:
- the shared, stateless instance
-
normalize
- Specified by:
normalizein interfaceopennlp.tools.util.normalizer.CharSequenceNormalizer
-