public class IndexedWord extends CoreLabel implements 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 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 |
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(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).
|
| 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(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(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.
|
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, wordcompact, containsKey, get, has, keySet, prettyLog, remove, set, setCapacity, size, toShorterString, toShortString, toShortStringpublic 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
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(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.public boolean equals(Object o)
equals in class ArrayCoreMappublic int hashCode()
hashCode in class ArrayCoreMappublic int compareTo(IndexedWord w)
compareTo in interface Comparable<IndexedWord>w - The IndexedWord to compare withpublic String toString()
public static void setPrintFormat(String printFormat)
public static LabelFactory factory()
public LabelFactory labelFactory()
null if no appropriate factory is known.labelFactory in interface LabellabelFactory in class CoreLabel