Package opennlp.tools.stemmer.hunspell
Class HunspellCompoundRule
java.lang.Object
opennlp.tools.stemmer.hunspell.HunspellCompoundRule
A compound flag sequence with optional and repeated elements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceInterprets a flag according to the affix file's FLAG setting. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]private static final Stringprivate static final intMaximum elements in one compound pattern.private final char[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateHunspellCompoundRule(int[] flags, char[] repetition) Initializes a parsed compound pattern. -
Method Summary
Modifier and TypeMethodDescription(package private) booleanTests a sequence of selected homonyms.(package private) static HunspellCompoundRuleparse(String pattern, int line, HunspellCompoundRule.FlagReader reader) Parses a compound rule.private voidskipOptional(boolean[] states) Advances states through optional pattern elements.
-
Field Details
-
MAX_ELEMENTS
private static final int MAX_ELEMENTSMaximum elements in one compound pattern.- See Also:
-
INVALID_PATTERN
- See Also:
-
flags
private final int[] flags -
repetition
private final char[] repetition
-
-
Constructor Details
-
HunspellCompoundRule
private HunspellCompoundRule(int[] flags, char[] repetition) Initializes a parsed compound pattern.- Parameters:
flags- The required flag at each position.repetition- The position's repetition operator or a space.
-
-
Method Details
-
parse
static HunspellCompoundRule parse(String pattern, int line, HunspellCompoundRule.FlagReader reader) throws IOException Parses a compound rule.- Parameters:
pattern- The rule text.line- The source line.reader- The flag decoder.- Returns:
- The parsed rule.
- Throws:
IOException- Thrown if the pattern or a flag is malformed.
-
matches
Tests a sequence of selected homonyms. Each part consumes one flag position.- Parameters:
parts- The flags of one selected entry per compound part.complete- Whether the sequence must complete the rule.- Returns:
- Whether the sequence is permitted by this rule.
-
skipOptional
private void skipOptional(boolean[] states) Advances states through optional pattern elements.- Parameters:
states- The active pattern positions.
-