public class AbstractTaggerRule extends java.lang.Object implements TaggerRule
This defines an interface for rule-based part of speech tag replacment in a tagged corpus. Each rule locates all the words in a corpus tagged with a specific original part of speech tag and satisfying a specific condition. When the condition is satisfied, the rule replaces the original tag with a replacement tag.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
originalTag
The original tag which this rule may change.
|
protected java.lang.String |
replacementTag
The replacement tag which this rule may emit.
|
Constructor and Description |
---|
AbstractTaggerRule() |
Modifier and Type | Method and Description |
---|---|
int |
applies(int site,
java.util.List trainingData)
See if this rule applies to a training site.
|
int |
apply(int[] sites,
java.util.List trainingData)
Apply this rule to a a list of training sites.
|
boolean |
apply(int site,
java.util.List trainingData)
Apply this rule to a specific training site.
|
int |
apply(java.util.List trainingData)
Apply this rule to all training data.
|
java.lang.String |
getOriginalTag()
Return original tag.
|
java.lang.String |
getReplacementTag()
Return replacement tag.
|
protected java.lang.String originalTag
protected java.lang.String replacementTag
public int apply(java.util.List trainingData)
apply
in interface TaggerRule
trainingData
- Training data as a list.public boolean apply(int site, java.util.List trainingData)
apply
in interface TaggerRule
site
- Index (0-based) of training site
at which to apply rule.trainingData
- Training data as a list.public int apply(int[] sites, java.util.List trainingData)
apply
in interface TaggerRule
sites
- Indices (0-based) of training sites
at which to apply rule.trainingData
- Training data as a list.public int applies(int site, java.util.List trainingData)
applies
in interface TaggerRule
site
- Index (0-based) of training site
at which to check that rule applies.trainingData
- Training data.public java.lang.String getOriginalTag()
getOriginalTag
in interface TaggerRule
public java.lang.String getReplacementTag()
getReplacementTag
in interface TaggerRule