edu.stanford.nlp.ling
Class MapLabel

java.lang.Object
  extended by edu.stanford.nlp.ling.AbstractMapLabel
      extended by edu.stanford.nlp.ling.MapLabel
All Implemented Interfaces:
HasCategory, HasContext, HasTag, HasWord, Label, Serializable

public class MapLabel
extends AbstractMapLabel

An AbstractMapLabel implementation which uses Object equality and hashcode.

Author:
Bill MacCartney, Teg Grenager
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.stanford.nlp.ling.AbstractMapLabel
AFTER_KEY, ANSWER_KEY, ARG_KEY, BEFORE_KEY, CATEGORY_FUNCTIONAL_TAG_KEY, CATEGORY_KEY, CURRENT_KEY, FEATURES_KEY, GOLDANSWER_KEY, HEAD_TAG_KEY, HEAD_WORD_KEY, INDEX_KEY, LEFT_TERM_KEY, map, MARKING_KEY, NER_KEY, PARENT_KEY, SEMANTIC_HEAD_POS_KEY, SEMANTIC_HEAD_WORD_KEY, SPAN_KEY, TAG_KEY, VALUE_KEY, VERB_SENSE_KEY, WORD_KEY
 
Constructor Summary
MapLabel()
          Create a new MapLabel with null value.
MapLabel(Label label)
          Create a new MapLabel with the value of another Label as its value.
MapLabel(String value)
          Create a new MapLabel with the given value.
 
Method Summary
static LabelFactory factory()
          Return a factory for MapLabels.
 LabelFactory labelFactory()
          Return a factory for MapLabels.
static void main(String[] args)
          For testing only.
static void setPrintOptions(String po)
           
 String toString()
          Return a String containing the value (and index, if any) of this label.
 String toString(String format)
          Returns a formatted string representing this label.
 
Methods inherited from class edu.stanford.nlp.ling.AbstractMapLabel
after, answer, appendAfter, before, category, current, get, getFeatures, getSemanticTag, getSemanticWord, goldAnswer, headTag, headWord, index, map, ner, prependBefore, put, setAfter, setAnswer, setBefore, setCategory, setCurrent, setFeatures, setFromString, setGoldAnswer, setHeadTag, setHeadWord, setIndex, setMap, setNER, setSemanticTag, setSemanticWord, setSpan, setTag, setValue, setWord, span, tag, value, word
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapLabel

public MapLabel()
Create a new MapLabel with null value.


MapLabel

public MapLabel(String value)
Create a new MapLabel with the given value.

Parameters:
value - the value of the new label

MapLabel

public MapLabel(Label label)
Create a new MapLabel with the value of another Label as its value.

If the argument label is a MapLabel, the new label is identical to the argument label (but does not share storage). If the argument is a MapLabel, it just copies the map, but doesn't make copies of the map's contents.

If the argument label implements HasWord and/or HasTag, such as a CategoryWordTag, the category, word, and tag are stored in the map of the new label under the map keys CATEGORY_KEY, WORD_KEY, and TAG_KEY, respectively.

Parameters:
label - the other label
Method Detail

labelFactory

public LabelFactory labelFactory()
Return a factory for MapLabels. The factory returned is always the same one (a singleton).

Returns:
the label factory

factory

public static LabelFactory factory()
Return a factory for MapLabels. The factory returned is always the same one (a singleton).

Returns:
the label factory

toString

public String toString()
Return a String containing the value (and index, if any) of this label. This is equivalent to toString("value-index").

Specified by:
toString in interface Label
Overrides:
toString in class Object
Returns:
a text representation of the full label contents

toString

public String toString(String format)
Returns a formatted string representing this label. The desired format is passed in as a String. Currently supported formats include:

Map is printed in alphabetical order of keys.


setPrintOptions

public static void setPrintOptions(String po)

main

public static void main(String[] args)
For testing only.



Stanford NLP Group