public class TextAnnotation extends AbstractTextAnnotation implements Serializable, Cloneable, HasAttributes
| Modifier and Type | Field and Description |
|---|---|
protected gnu.trove.map.TIntObjectMap<ArrayList<IntPair>> |
allSpans |
protected Map<String,String> |
attributes
Mop containing attributes/metadata information related to TextAnnotation.
|
protected int[] |
characterOffsetsToTokens
A map from character offset to the token id.
|
protected String |
corpusId
An identifier for the corpus
|
protected String |
id
The identifier for this text annotation
|
protected List<Sentence> |
sentences
The list of sentences contained in this text
|
text, tokenCharacterOffsets, tokenizedText, tokens, views| Constructor and Description |
|---|
TextAnnotation(String corpusId,
String id,
String text,
IntPair[] characterOffsets,
String[] tokens,
int[] sentenceEndPositions) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String key,
String value) |
void |
addView(Annotator annotator)
Adds a view that is generated by a
Annotator |
Object |
clone() |
boolean |
equals(Object obj) |
String |
getAttribute(String key) |
Set<String> |
getAttributeKeys() |
String |
getCorpusId() |
String |
getId() |
int |
getNumberOfSentences() |
Sentence |
getSentence(int sentenceId) |
Sentence |
getSentenceFromToken(int tokenId)
Gets the sentence containing the specified token
|
List<Sentence> |
getSentenceFromTokens(Set<Integer> tokens) |
int |
getSentenceId(Constituent constituent) |
int |
getSentenceId(int tokenId)
Gets the index of the sentence that contains the token, indexed by tokenPosition.
|
List<IntPair> |
getSpansMatching(String text) |
int |
getTokenIdFromCharacterOffset(int characterOffset)
Get the position of token that corresponds to the character offset that is passed as a
parameter.
|
boolean |
hasAttribute(String key) |
int |
hashCode() |
void |
removeAllAttributes() |
List<Sentence> |
sentences() |
void |
setSentences()
allows user to force sentences field to be (re-)populated based on Sentence
View, possibly after modifying sentence View. |
String |
toString() |
addTopKView, addView, addViews, getAvailableViews, getText, getToken, getTokenCharacterOffset, getTokenizedText, getTokens, getTokensInSpan, getTopKViews, getView, hasView, removeAllViews, removeView, select, setTokens, sizeprotected String corpusId
protected String id
protected int[] characterOffsetsToTokens
getTokenIdFromCharacterOffset(int)
is called the first time.public void addView(Annotator annotator) throws AnnotatorException
AnnotatorAnnotatorExceptionpublic String getCorpusId()
public String getId()
public int getNumberOfSentences()
public Sentence getSentence(int sentenceId)
public int getSentenceId(Constituent constituent)
public int getSentenceId(int tokenId)
getSentence(int)
.tokenId - The index of the token whose sentenceId is neededIllegalArgumentException - if no sentence contains the tokenIdpublic Sentence getSentenceFromToken(int tokenId)
public void setSentences()
View, possibly after modifying sentence View.
WARNING: if youpublic int getTokenIdFromCharacterOffset(int characterOffset)
public Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic void addAttribute(String key, String value)
addAttribute in interface HasAttributespublic String getAttribute(String key)
getAttribute in interface HasAttributespublic Set<String> getAttributeKeys()
getAttributeKeys in interface HasAttributespublic boolean hasAttribute(String key)
hasAttribute in interface HasAttributespublic void removeAllAttributes()
removeAllAttributes in interface HasAttributesCopyright © 2017. All rights reserved.