Package opennlp.tools.util.normalizer
Class CaseFoldCharSequenceNormalizer
java.lang.Object
opennlp.tools.util.normalizer.CaseFoldCharSequenceNormalizer
- All Implemented Interfaces:
Serializable,opennlp.tools.util.normalizer.CharSequenceNormalizer
public class CaseFoldCharSequenceNormalizer
extends Object
implements opennlp.tools.util.normalizer.CharSequenceNormalizer
A
CharSequenceNormalizer that lower cases text for case-insensitive matching. It uses
Locale.ROOT by default, so the result does not depend on the JVM's default locale.
Locale.ROOT avoids locale surprises such as the Turkish dotless-i
mapping. A specific locale can be supplied through CaseFoldCharSequenceNormalizer(Locale)
or getInstance(Locale) when a language's case rules are wanted (Turkish being the classic
example). Full Unicode case folding (for example German eszett, U+00DF, to ss) is
a distinct, heavier transform and is intentionally out of scope here.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a normalizer that lower cases usingLocale.ROOT.CaseFoldCharSequenceNormalizer(Locale locale) Creates a normalizer that lower cases using the given locale. -
Method Summary
Modifier and TypeMethodDescriptionReturns the shared, statelessLocale.ROOTinstance.getInstance(Locale locale) Returns a normalizer for the given locale.normalize(CharSequence text)
-
Constructor Details
-
CaseFoldCharSequenceNormalizer
public CaseFoldCharSequenceNormalizer()Creates a normalizer that lower cases usingLocale.ROOT. -
CaseFoldCharSequenceNormalizer
Creates a normalizer that lower cases using the given locale.- Parameters:
locale- The locale whose case rules to apply.
-
-
Method Details
-
getInstance
Returns the shared, statelessLocale.ROOTinstance.- Returns:
- the shared, stateless
Locale.ROOTinstance
-
getInstance
Returns a normalizer for the given locale. The sharedLocale.ROOTinstance is returned forLocale.ROOT.- Parameters:
locale- The locale whose case rules to apply.- Returns:
- a normalizer for the given locale
- Throws:
NullPointerException- Thrown iflocaleis null; callgetInstance()for the locale-independent default.
-
normalize
- Specified by:
normalizein interfaceopennlp.tools.util.normalizer.CharSequenceNormalizer
-