edu.stanford.nlp.tagger.maxent
Class Extractor
java.lang.Object
edu.stanford.nlp.tagger.maxent.Extractor
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- ExtractorDistsim, ExtractorDistsim.ExtractorDistsimConjunction, ExtractorVerbalVBNZero
public class Extractor
- extends Object
- implements Serializable
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 x are effectively vectors
of values, with each dimension being the output of some extractor.
- Author:
- Kristina Toutanova
- See Also:
- Serialized Form
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. |
Extractor
public Extractor()
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.
- Parameters:
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.
precondition
public boolean precondition(String tag)
- This evaluates any precondition for a feature being applicable based
on a certain tag. It returns true if the feature is applicable.
By default an Extractor is applicable everywhere, but some
subclasses limit application.
- Parameters:
tag
- The possible tag that the feature will be generated for
- Returns:
- Whether the feature extractor is applicable (true) or not (false)
leftContext
public int leftContext()
- Returns:
- the number of positions to the left the extractor looks at (only tags, because words are fixed.)
rightContext
public int rightContext()
- Returns:
- the number of positions to the right the etxractor looks at (only tags, because words are fixed.)
isDynamic
public boolean isDynamic()
- Returns:
- Returns true if extractor is a function of POS tags; if it returns false,
features are pre-computed.
isLocal
public boolean isLocal()
- Returns:
- Returns true if extractor is not a function of POS tags, and only
depends on current word.
toString
public String toString()
- Overrides:
toString
in class Object
Stanford NLP Group