public class DefaultLemmatizerRule extends java.lang.Object implements LemmatizerRule
A lemmarizer rule specifies a string substitution pattern used as part of the process of reducing an elaborated morphological form to its base form (lemma).
Modifier and Type | Field and Description |
---|---|
protected java.util.regex.Pattern |
compiledSource
Compiled source pattern matcher.
|
protected int |
direction |
static int |
LEFT
Match direction (LEFT or RIGHT).
|
protected int |
matchLength
Minimum match length.
|
protected boolean |
mustMatchDictionaryEntry
Must match dictionary entry.
|
protected java.lang.String |
replacement
Replacement string.
|
static int |
RIGHT |
protected java.lang.String |
ruleText
Original rule text.
|
protected java.lang.String |
source
Source pattern string to match.
|
protected static java.util.regex.Pattern |
VCRMatcher
Compiled VCR string matcher.
|
Constructor and Description |
---|
DefaultLemmatizerRule(java.lang.String ruleText)
Create a lemmatizer rule.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
apply(java.lang.String s)
Apply a lemmatization rule to a string.
|
java.lang.String |
apply(java.lang.String s,
java.util.Set<java.lang.String> dictionary)
Apply a lemmatization rule to a string.
|
java.lang.String |
toString()
Return string version of rule.
|
protected java.lang.String ruleText
protected java.lang.String source
protected java.util.regex.Pattern compiledSource
protected java.lang.String replacement
protected static final java.util.regex.Pattern VCRMatcher
public static final int LEFT
public static final int RIGHT
protected int direction
protected int matchLength
protected boolean mustMatchDictionaryEntry
public DefaultLemmatizerRule(java.lang.String ruleText)
ruleText
- The rule text.public java.lang.String apply(java.lang.String s, java.util.Set<java.lang.String> dictionary)
apply
in interface LemmatizerRule
s
- String to which to apply rule.dictionary
- List of known words.public java.lang.String apply(java.lang.String s)
apply
in interface LemmatizerRule
s
- String to which to apply rule.public java.lang.String toString()
toString
in class java.lang.Object