public class IndexedWord extends CoreLabel implements java.lang.Comparable<IndexedWord>
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.CoreLabel.GenericAnnotation<T>
TypesafeMap.Key<VALUE>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMPLETE_FORMAT |
static IndexedWord |
NO_WORD
The identifier that points to no word.
|
static java.lang.String |
VALUE_FORMAT |
static java.lang.String |
WORD_FORMAT
Various printing options for toString
|
static java.lang.String |
WORD_TAG_FORMAT |
static java.lang.String |
WORD_TAG_INDEX_FORMAT |
DEFAULT_FORMAT, genericKeys, genericValues, TAG_SEPARATOR
Constructor and Description |
---|
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(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(java.lang.String docID,
int sentenceIndex,
int index)
Constructor for setting docID, sentenceIndex, and
index without any other annotations.
|
IndexedWord(java.lang.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).
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IndexedWord w)
NOTE: This compareTo is based on and made to be compatible with the one
from IndexedFeatureLabel.
|
boolean |
equals(java.lang.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.
|
LabelFactory |
labelFactory()
Returns a factory that makes labels of the exact same type as this one.
|
static void |
setPrintFormat(java.lang.String printFormat) |
java.lang.String |
toString()
Computes the toString based on whatever the printFormat is
currently set as.
|
java.lang.String |
toString(java.lang.String format)
Prints the toString in the form of format.
|
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, toPrimes, value, word
compact, containsKey, get, has, keySet, prettyLog, remove, set, setCapacity, size, toShorterString, toShortString, toShortString
public static final IndexedWord NO_WORD
public static final java.lang.String WORD_FORMAT
public static final java.lang.String WORD_TAG_FORMAT
public static final java.lang.String WORD_TAG_INDEX_FORMAT
public static final java.lang.String VALUE_FORMAT
public static final java.lang.String COMPLETE_FORMAT
public IndexedWord()
CoreLabel
default constructorpublic 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 constructorw
- A Label to initialize this IndexedWord frompublic IndexedWord(java.lang.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(java.lang.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.public boolean equals(java.lang.Object o)
equals
in class ArrayCoreMap
public int hashCode()
hashCode
in class ArrayCoreMap
public int compareTo(IndexedWord w)
compareTo
in interface java.lang.Comparable<IndexedWord>
w
- The IndexedWord to compare withpublic java.lang.String toString()
public static void setPrintFormat(java.lang.String printFormat)
public java.lang.String toString(java.lang.String format)
public static LabelFactory factory()
public LabelFactory labelFactory()
null
if no appropriate factory is known.labelFactory
in interface Label
labelFactory
in class CoreLabel