|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.ArrayCoreMap
edu.stanford.nlp.ling.CoreLabel
edu.stanford.nlp.ling.IndexedWord
public class IndexedWord
This class is mainly for use with RTE in terms of the methods it provides,
but on a more general level, it provides a CoreLabel
that uses its
DocIDAnnotation, SentenceIndexAnnotation, and IndexAnnotation to implement
Comparable/compareTo, hashCode, and equals. This means no other annotations,
including the identity of the word, are taken into account when using these
methods.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.stanford.nlp.ling.CoreLabel |
---|
CoreLabel.GenericAnnotation<T> |
Nested classes/interfaces inherited from interface edu.stanford.nlp.util.TypesafeMap |
---|
TypesafeMap.Key<BASE,VALUE> |
Field Summary | |
---|---|
static String |
COMPLETE_FORMAT
|
static IndexedWord |
NO_WORD
The identifier that points to no word. |
static String |
VALUE_FORMAT
|
static String |
WORD_FORMAT
Various printing options for toString |
static String |
WORD_TAG_FORMAT
|
static String |
WORD_TAG_INDEX_FORMAT
|
Fields inherited from class edu.stanford.nlp.ling.CoreLabel |
---|
genericKeys, genericValues, TAG_SEPARATOR |
Constructor Summary | |
---|---|
IndexedWord()
Default constructor; uses CoreLabel default constructor |
|
IndexedWord(CoreLabel w)
Construct an IndexedWord from a CoreLabel just as for a CoreMap. |
|
IndexedWord(CoreMap w)
Copy Constructor - relies on CoreLabel copy constructor |
|
IndexedWord(CyclicCoreLabel w)
Copy Constructor - relies on CoreLabel copy constructor
It will set the value, and if the word is not set otherwise, set
the word to the value. |
|
IndexedWord(Label w)
Copy Constructor - relies on CoreLabel copy constructor
It will set the value, and if the word is not set otherwise, set
the word to the value. |
|
IndexedWord(String docID,
int sentenceIndex,
int index)
Constructor for setting docID, sentenceIndex, and index without any other annotations. |
|
IndexedWord(String docID,
int sentenceIndex,
int index,
CoreLabel label)
Copies the given label and then sets the docID, sentenceIndex, and Index; if these differ from those in label, the parameters will be used (not the label values). |
Method Summary | |
---|---|
int |
compareTo(IndexedWord w)
NOTE: This compareTo is based on and made to be compatible with the one from IndexedFeatureLabel. |
boolean |
equals(Object o)
This .equals is dependent only on docID, sentenceIndex, and index. |
static LabelFactory |
factory()
|
int |
hashCode()
This hashcode uses only the docID, sentenceIndex, and index See compareTo for more info |
LabelFactory |
labelFactory()
Returns a factory that makes labels of the exact same type as this one. |
static void |
setPrintFormat(String printFormat)
|
String |
toString()
Computes the toString based on whatever the printFormat is currently set as. |
String |
toString(String format)
Prints the toString in the form of format. |
Methods inherited from class edu.stanford.nlp.ling.CoreLabel |
---|
after, before, beginPosition, category, docID, endPosition, getString, index, lemma, ner, originalText, sentIndex, setAfter, setBefore, setBeginPosition, setCategory, setDocID, setEndPosition, setFromString, setIndex, setLemma, setNER, setOriginalText, setSentIndex, setTag, setValue, setWord, tag, value, word |
Methods inherited from class edu.stanford.nlp.util.ArrayCoreMap |
---|
compact, containsKey, get, has, keySet, remove, set, setCapacity, size, toShorterString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final IndexedWord NO_WORD
public static final String WORD_FORMAT
public static final String WORD_TAG_FORMAT
public static final String WORD_TAG_INDEX_FORMAT
public static final String VALUE_FORMAT
public static final String COMPLETE_FORMAT
Constructor Detail |
---|
public IndexedWord()
CoreLabel
default constructor
public IndexedWord(Label w)
CoreLabel
copy constructor
It will set the value, and if the word is not set otherwise, set
the word to the value.
w
- A Label to initialize this IndexedWord frompublic IndexedWord(CoreLabel w)
w
- A Label to initialize this IndexedWord frompublic IndexedWord(CoreMap w)
CoreLabel
copy constructor
w
- A Label to initialize this IndexedWord frompublic IndexedWord(CyclicCoreLabel w)
CoreLabel
copy constructor
It will set the value, and if the word is not set otherwise, set
the word to the value.
w
- A Label to initialize this IndexedWord frompublic IndexedWord(String docID, int sentenceIndex, int index)
docID
- The document ID (arbitrary string)sentenceIndex
- The sentence number in the document (normally 0-based)index
- The index of the word in the sentence (normally 0-based)public IndexedWord(String docID, int sentenceIndex, int index, CoreLabel label)
docID
- The document ID (arbitrary string)sentenceIndex
- The sentence number in the document (normally 0-based)index
- The index of the word in the sentence (normally 0-based)label
- The CoreLabel to initialize all other fields from.Method Detail |
---|
public boolean equals(Object o)
equals
in class ArrayCoreMap
public int hashCode()
hashCode
in class ArrayCoreMap
public int compareTo(IndexedWord w)
compareTo
in interface Comparable<IndexedWord>
w
- The IndexedWord to compare with
public String toString()
toString
in interface Label
toString
in class ArrayCoreMap
public static void setPrintFormat(String printFormat)
public String toString(String format)
format
- One of the constants defined for this class. (You must use
one of these constants, because the Strings are compared by ==.)
public static LabelFactory factory()
public LabelFactory labelFactory()
null
if no appropriate factory is known.
labelFactory
in interface Label
labelFactory
in class CoreLabel
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |