|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.ling.AbstractMapLabel
edu.stanford.nlp.ling.FeatureLabel
public class FeatureLabel
An AbstractMapLabel
implementation which defines equality
as equality of the internal map. Thus it is NOT SAFE for use in cyclic
data structures, in which the map may point to something which in turn
points to this map again, as calling equals() will lead to an infinite
recursion.
Field Summary | |
---|---|
Collection |
features
|
static String |
TOSTRING_FORMAT
|
Fields inherited from class edu.stanford.nlp.ling.AbstractMapLabel |
---|
AFTER_KEY, ANSWER_KEY, ARG_KEY, BEFORE_KEY, CATEGORY_FUNCTIONAL_TAG_KEY, CATEGORY_KEY, CH_CHAR_KEY, CH_ORIG_SEG_KEY, CH_SEG_KEY, COREF_KEY, CURRENT_KEY, FEATURES_KEY, GAZETTEER_KEY, GOLDANSWER_KEY, HEAD_TAG_KEY, HEAD_WORD_KEY, INDEX_KEY, INTERPRETATION_KEY, LEFT_TERM_KEY, LEMMA_KEY, map, mapFactory, MARKING_KEY, NER_KEY, PARENT_KEY, POLARITY_KEY, PROJ_CAT_KEY, ROLE_KEY, SEMANTIC_HEAD_POS_KEY, SEMANTIC_HEAD_WORD_KEY, SHAPE_KEY, SPAN_KEY, STEM_KEY, TAG_KEY, VALUE_KEY, VERB_SENSE_KEY, WORD_KEY |
Constructor Summary | |
---|---|
FeatureLabel()
|
|
FeatureLabel(AbstractMapLabel other)
Copy constructor. |
|
FeatureLabel(Map map)
Copy constructor. |
|
FeatureLabel(MapFactory mapFactory)
|
|
FeatureLabel(String[] keys,
String[] values)
|
Method Summary | |
---|---|
String |
after()
Return the String after the word, which is stored in the map under the key . |
String |
answer()
convenience method for getting answer * |
void |
appendAfter(String after)
Append this String to the current after String |
String |
before()
Return the String before the word, which is stored in the map under the key . |
String |
coref()
Return the coreferent of the word, which is stored in the map under the key . |
String |
current()
Return the String which is the unmangled word, which is stored in the map under the key . |
boolean |
equals(Object o)
|
static LabelFactory |
factory()
|
String |
getString(Object attribute)
Return the String value of the FeatureLabel for an arbitrary key. |
String |
goldAnswer()
convenience method for getting gold answer * |
int |
hashCode()
|
void |
internValues(Interner interner)
Interns all of the keys and values in the underlying map of this FeatureLabel. |
Set |
keySet()
|
LabelFactory |
labelFactory()
Returns a factory that makes labels of the exact same type as this one. |
String |
lemma()
|
Map |
map()
Return the Map contained in this label. |
static String[] |
mapStringToArray(String map)
|
String |
ner()
Return the NER type of the word, which is stored in the map under the key . |
void |
prependBefore(String before)
Prepend this String to the current before String |
void |
remove(String key)
|
void |
set(Object attribute,
Object value)
|
void |
setAfter(String after)
Set the String after the word by storing it in the map under the key . |
void |
setAnswer(String answer)
convenience method for setting answer * |
void |
setBefore(String before)
Set the String before the word by storing it in the map under the key . |
void |
setCurrent(String current)
Set the String which is the unmangled word, which is stored in the map under the key . |
void |
setFromString(String labelStr)
Set value for the label from a String. |
void |
setGoldAnswer(String goldAnswer)
convenience method for setting gold answer * |
void |
setNER(String ner)
Set the NER label for the word, using the key . |
void |
setValue(String value)
Set the value for the label. |
void |
setWord(String word)
convenience method for setting word * |
String |
tag()
Return the head tag of the label (or null if none),
which is stored in the map under the key . |
static String |
toOriginalString(List<FeatureLabel> sentence)
Pieces a List of MapLabels back together using before, after and current. |
static String |
toSentence(List<? extends FeatureLabel> sentence)
Pieces a List of MapLabels back together using word and setting a white space between each word |
String |
toString()
Return a String representation of the label. |
String |
toString(String format)
|
String |
value()
Return a String representation of just the "main" value of this label. |
static FeatureLabel |
valueOf(String s,
MapFactory mf)
Uses String representation of a Map to populate Map with String keys and String values. |
String |
word()
convenience method for getting word * |
Methods inherited from class edu.stanford.nlp.ling.AbstractMapLabel |
---|
category, get, getFeatures, getLemma, getRole, getSemanticTag, getSemanticWord, headTag, headWord, index, interpretation, put, setCategory, setFeatures, setHeadTag, setHeadWord, setIndex, setInterpretation, setLemma, setRole, setSemanticTag, setSemanticWord, setShape, setSpan, setTag, shape, span |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static String TOSTRING_FORMAT
public Collection features
Constructor Detail |
---|
public FeatureLabel()
public FeatureLabel(MapFactory mapFactory)
public FeatureLabel(String[] keys, String[] values)
keys
- values
- public FeatureLabel(AbstractMapLabel other)
public FeatureLabel(Map map)
Method Detail |
---|
public Set keySet()
public static FeatureLabel valueOf(String s, MapFactory mf) throws Exception
Exception
public static String[] mapStringToArray(String map)
public String word()
word
in interface HasWord
word
in class AbstractMapLabel
public String answer()
answer
in class AbstractMapLabel
public String goldAnswer()
goldAnswer
in class AbstractMapLabel
public void setWord(String word)
setWord
in interface HasWord
setWord
in class AbstractMapLabel
word
- the head word for the labelpublic void setAnswer(String answer)
setAnswer
in class AbstractMapLabel
public void setGoldAnswer(String goldAnswer)
setGoldAnswer
in class AbstractMapLabel
public String before()
BEFORE_KEY
.
before
in interface HasContext
before
in class AbstractMapLabel
public void setBefore(String before)
BEFORE_KEY
.
setBefore
in interface HasContext
setBefore
in class AbstractMapLabel
before
- the String before the wordpublic void prependBefore(String before)
prependBefore
in interface HasContext
prependBefore
in class AbstractMapLabel
before
- the String to be prependedpublic String current()
CURRENT_KEY
.
current
in interface HasContext
current
in class AbstractMapLabel
public void setCurrent(String current)
CURRENT_KEY
.
setCurrent
in interface HasContext
setCurrent
in class AbstractMapLabel
current
- the unmangled wordpublic String after()
AFTER_KEY
.
after
in interface HasContext
after
in class AbstractMapLabel
public void setAfter(String after)
AFTER_KEY
.
setAfter
in interface HasContext
setAfter
in class AbstractMapLabel
after
- The String after the wordpublic void appendAfter(String after)
appendAfter
in interface HasContext
appendAfter
in class AbstractMapLabel
after
- The String to be prependedpublic String ner()
NER_KEY
.
ner
in class AbstractMapLabel
public void setNER(String ner)
NER_KEY
.
setNER
in class AbstractMapLabel
ner
- The String ner the wordpublic String coref()
NER_KEY
.
public static String toOriginalString(List<FeatureLabel> sentence)
public static String toSentence(List<? extends FeatureLabel> sentence)
public String value()
Label
value
in interface Label
value
in class AbstractMapLabel
public void setValue(String value)
AbstractMapLabel
setValue
in interface Label
setValue
in class AbstractMapLabel
value
- the value for the labelpublic String toString()
Label
toString()
method
causes a label to spill its guts. It should always return an
empty string rather than null
if there is no value.
toString
in interface Label
toString
in class Object
public String toString(String format)
public void setFromString(String labelStr)
AbstractMapLabel
setFromString
in interface Label
setFromString
in class AbstractMapLabel
labelStr
- the string value for the labelpublic LabelFactory labelFactory()
Label
null
if no appropriate factory is known.
public static LabelFactory factory()
public void internValues(Interner interner)
interner
- public String lemma()
public String tag()
AbstractMapLabel
null
if none),
which is stored in the map under the key TAG_KEY
.
tag
in interface HasTag
tag
in class AbstractMapLabel
public String getString(Object attribute)
public void set(Object attribute, Object value)
public Map map()
AbstractMapLabel
Map
contained in this label.
map
in class AbstractMapLabel
Map
contained in this AbstractMapLabelpublic boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void remove(String key)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |