Class NormalizationProfiles
java.lang.Object
opennlp.tools.util.normalizer.NormalizationProfiles
A registry of
NormalizationProfiles by language, with detection-based fallback: pick the
profile for a requested language, or detect the language with a LanguageDetector when it
is unspecified. The covered languages are the Snowball stemmer algorithms that name a natural
language -- every SnowballStemmer.ALGORITHM except PORTER, which is an
English-only algorithm variant rather than a distinct language. Several codes can map to one
algorithm (the three Norwegian written standards all use NORWEGIAN).
Profiles are keyed by ISO 639-3 code (what LanguageDetector produces);
forLanguage(String) also accepts ISO 639-1 two-letter codes and the ISO 639-2
bibliographic codes dut, fre and ger.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<NormalizationProfile> detect(CharSequence text, opennlp.tools.langdetect.LanguageDetector detector) Detects the language oftextand returns itsprofile.static Optional<NormalizationProfile> forLanguage(String language) Returns theprofilefor a language.Returns the ISO 639-3 codes of the supported languages.
-
Method Details
-
forLanguage
Returns theprofilefor a language.- Parameters:
language- An ISO 639-3, ISO 639-2 bibliographic or ISO 639-1 language code; case-insensitive. Must not benull.- Returns:
- The profile, or empty if the language has no Snowball stemmer.
- Throws:
IllegalArgumentException- iflanguageisnull.
-
detect
public static Optional<NormalizationProfile> detect(CharSequence text, opennlp.tools.langdetect.LanguageDetector detector) Detects the language oftextand returns itsprofile.- Parameters:
text- The text to detect. Must not benull.detector- The language detector to use. Must not benull.- Returns:
- The profile for the detected language, or empty if it has no Snowball stemmer.
- Throws:
IllegalArgumentException- iftextordetectorisnull.
-
supportedLanguages
-