Package opennlp.tools.util.featuregen
Class FeatureGeneratorUtil
java.lang.Object
opennlp.tools.util.featuregen.FeatureGeneratorUtil
This class provide common utilities for feature generation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanisCapPeriod(String token) Tests for one uppercase code point followed by a period, and nothing else.private static booleanisLegacyCapPeriod(String token) The pre-3.0.0 shape, kept forCompatibilityMode.LEGACY: an ASCII capital or one ofÄ,Ö,Ü, then a period, then the end of the token or one line terminator, which the$of the pattern^[A-ZÄÖÜ]\\.$accepted.static StringtokenFeature(String token) Generates a class name for the specified token.
-
Field Details
-
A_UMLAUT
private static final char A_UMLAUT- See Also:
-
O_UMLAUT
private static final char O_UMLAUT- See Also:
-
U_UMLAUT
private static final char U_UMLAUT- See Also:
-
PERIOD
private static final char PERIOD- See Also:
-
-
Constructor Details
-
FeatureGeneratorUtil
public FeatureGeneratorUtil()
-
-
Method Details
-
tokenFeature
Generates a class name for the specified token. The classes are as follows where the first matching class is used:- jah - Japanese Hiragana
- jak - Japanese Katakana
- lc - lowercase alphabetic
- 2d - two digits
- 4d - four digits
- an - alpha-numeric
- dd - digits and dashes
- ds - digits and slashes
- dc - digits and commas
- dp - digits and periods
- num - digits
- sc - single capital letter
- ac - all capital letters
- cp - a single capital letter followed by a period
- ic - initial capital letter
- other - other
- Parameters:
token- A token or word.- Returns:
- The class name that the specified token belongs in.
-
isCapPeriod
Tests for one uppercase code point followed by a period, and nothing else. Any script counts, including the supplementary planes. UnderCompatibilityMode.LEGACYthe pre-3.0.0 shape applies instead, seeisLegacyCapPeriod(String).- Parameters:
token- The token.- Returns:
truefor exactly that shape.
-
isLegacyCapPeriod
The pre-3.0.0 shape, kept forCompatibilityMode.LEGACY: an ASCII capital or one ofÄ,Ö,Ü, then a period, then the end of the token or one line terminator, which the$of the pattern^[A-ZÄÖÜ]\\.$accepted.- Parameters:
token- The token.- Returns:
truefor exactly that shape.
-