Package opennlp.tools.tokenize.uax29
Enum Class WordType
- All Implemented Interfaces:
Serializable,Comparable<WordType>,Constable
The category of a word token.
ALPHANUMERIC and
NUMERIC cover letter and digit words; the remaining categories identify scripts and
emoji that benefit from script-specific handling. The boundaries themselves follow the Unicode
release shipped with WordSegmenter.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA token that contains at least one letter (optionally mixed with digits and connectors).An emoji, emoji sequence, or regional-indicator flag.A Hangul token.A Hiragana token.A token containing a Han ideograph (one ideograph per token under UAX #29 segmentation).A Katakana token.A token made up entirely of digits and numeric connectors.A token in a Southeast Asian script that requires dictionary segmentation (Thai, Lao, ...). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]private static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte[](package private) static WordTypeof(CharSequence text, int start, int end) Classifies the code points oftextover[start, end)as a word token type, ornullwhen the range is not a word (pure whitespace, punctuation, or symbols).private static WordTypescriptType(int codePoint) static WordTypeReturns the enum constant of this class with the specified name.static WordType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ALPHANUMERIC
A token that contains at least one letter (optionally mixed with digits and connectors). -
NUMERIC
A token made up entirely of digits and numeric connectors. -
IDEOGRAPHIC
A token containing a Han ideograph (one ideograph per token under UAX #29 segmentation). -
HIRAGANA
A Hiragana token. -
KATAKANA
A Katakana token. -
HANGUL
A Hangul token. -
SOUTHEAST_ASIAN
A token in a Southeast Asian script that requires dictionary segmentation (Thai, Lao, ...). -
EMOJI
An emoji, emoji sequence, or regional-indicator flag.
-
-
Field Details
-
LOWEST_SCRIPT_CODE_POINT
private static final int LOWEST_SCRIPT_CODE_POINT- See Also:
-
ASCII_KIND
private static final byte[] ASCII_KIND
-
-
Constructor Details
-
WordType
private WordType()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
buildAsciiKind
private static byte[] buildAsciiKind() -
of
Classifies the code points oftextover[start, end)as a word token type, ornullwhen the range is not a word (pure whitespace, punctuation, or symbols). Emoji win over scripts, scripts over the generic alphanumeric/numeric split. The script category is taken from the first script code point in the range; UAX #29 word segments are single-script in practice, so for an unusual mixed-script run this reports the leading script, not a per-character determination.- Parameters:
text- The text containing the token.start- The inclusive start character offset.end- The exclusive end character offset.- Returns:
- The token type, or
nullif the range is not a word. - Throws:
IllegalStateException- Thrown if the bundledExtended_Pictographicdata resource is missing (raised transitively throughExtendedPictographic).UncheckedIOException- Thrown if that resource cannot be read.
-
scriptType
-