public class Extractor
extends java.lang.Object
implements java.io.Serializable
New extractors are created in either ExtractorFrames or ExtractorFramesRare; those are the places you want to consider adding your new extractor. For a new Extractor, typically the things that you have to define are:
Note that some extractors can be reused across multiple taggers, but many cannot. Any extractor that uses information from the tagger such as its dictionary, for example, cannot. For the moment, some of the extractors in ExtractorFrames and ExtractorFramesRare are static; those are all reusable at the moment, but if you change them in any way to make them not reusable, make sure to change the way they are constructed as well.
Modifier and Type | Field and Description |
---|---|
static Extractor[] |
EMPTY_EXTRACTOR_ARRAY |
Modifier | Constructor and Description |
---|---|
|
Extractor() |
protected |
Extractor(int position,
boolean isTag)
This constructor creates an extractor which extracts either the tag or
the word from position position in the history.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isDynamic() |
boolean |
isLocal() |
int |
leftContext() |
boolean |
precondition(java.lang.String tag)
This evaluates any precondition for a feature being applicable based
on a certain tag.
|
int |
rightContext() |
protected void |
setGlobalHolder(MaxentTagger tagger)
Subclasses should override this method and keep only the data
they want about the tagger.
|
java.lang.String |
toString() |
public static final Extractor[] EMPTY_EXTRACTOR_ARRAY
public Extractor()
protected Extractor(int position, boolean isTag)
position
- The position of the thing to be extracted. This is
relative to the current word. For example, position 0
will be the current word, -1 will be
the word before +1 will be the word after, etc.isTag
- If true this means that the POS tag is extracted from
position, otherwise the word is extracted.protected void setGlobalHolder(MaxentTagger tagger)
public boolean precondition(java.lang.String tag)
tag
- The possible tag that the feature will be generated forpublic int leftContext()
public int rightContext()
public boolean isDynamic()
public boolean isLocal()
public java.lang.String toString()
toString
in class java.lang.Object