|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.tagger.maxent.Extractor
public class Extractor
This class serves as the base class for classes which extract relevant information from a history to give it to the features. Every feature has an associated extractor or maybe more. GlobalHolder keeps all the extractors; two histories are considered equal if all extractors return equal values for them. The main functionality of the Extractors is provided by the method extract which takes a History as an argument. The Extractor looks at the history and takes out something important for the features - e.g. specific words and tags at specific positions or some function of the History. The histories are effectively vectors of values, with each dimension being the output of some extractor.
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.
Constructor Summary | |
---|---|
|
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. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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.Method Detail |
---|
protected void setGlobalHolder(MaxentTagger tagger)
public boolean precondition(java.lang.String tag)
tag
- The possible tag that the feature will be generated for
public int leftContext()
public int rightContext()
public boolean isDynamic()
public boolean isLocal()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |