public class Sentence extends AbstractTextAnnotation implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected static ITransformer<View,Double> |
defaultViewScoreSplitter |
protected Constituent |
sentenceConstituent |
protected TextAnnotation |
textAnnotation |
text, tokenCharacterOffsets, tokenizedText, tokens, views| Constructor and Description |
|---|
Sentence(Constituent sentenceConstituent)
Create a sentence out of a sentenceConstituent.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTopKView(String viewName,
List<View> view)
Overrides for forbidden methods.
|
void |
addView(String viewName,
View view)
Adds the top scoring value for the view identified by
viewName. |
void |
addViews(String[] viewNames,
View[] views) |
boolean |
equals(Object obj) |
int |
getEndSpan() |
Constituent |
getSentenceConstituent() |
int |
getSentenceId() |
int |
getStartSpan() |
String |
getText()
Gets the raw text
|
String |
getToken(int position)
Get the token at position from this text
|
String |
getTokenizedText()
Gets the tokenized text.
|
String[] |
getTokens()
Gets the tokens in this text.
|
List<View> |
getTopKViews(String viewName)
Get all the values available for a given view, identified by
viewName |
View |
getView(String viewName)
Gets the highest scoring value for the view identified by
viewName. |
int |
hashCode() |
boolean |
hasView(String viewName)
Checks if this text annotation has a view identified by
viewName |
void |
removeAllViews() |
void |
removeView(String viewName)
Remove a given view
|
void |
setTokens(String[] tokens,
IntPair[] tokenCharacterOffsets)
Set the tokens for this text.
|
int |
size()
Get the number of tokens in this text.
|
String |
toString() |
getAvailableViews, getTokenCharacterOffset, getTokensInSpan, selectprotected TextAnnotation textAnnotation
protected Constituent sentenceConstituent
protected static final ITransformer<View,Double> defaultViewScoreSplitter
public Sentence(Constituent sentenceConstituent)
public int getEndSpan()
public View getView(String viewName)
AbstractTextAnnotationviewName.getView in class AbstractTextAnnotationpublic boolean hasView(String viewName)
AbstractTextAnnotationviewNamehasView in class AbstractTextAnnotationtrue if the text annotation contains a view called viewName and
false otherwisepublic Constituent getSentenceConstituent()
public int getStartSpan()
public List<View> getTopKViews(String viewName)
AbstractTextAnnotationviewNamegetTopKViews in class AbstractTextAnnotationpublic String[] getTokens()
AbstractTextAnnotationgetTokens in class AbstractTextAnnotationpublic int size()
AbstractTextAnnotationsize in class AbstractTextAnnotationpublic String getText()
AbstractTextAnnotationgetText in class AbstractTextAnnotationpublic String getTokenizedText()
AbstractTextAnnotationgetTokenizedText in class AbstractTextAnnotationpublic String getToken(int position)
AbstractTextAnnotationgetToken in class AbstractTextAnnotationpublic int getSentenceId()
@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void addTopKView(String viewName, List<View> view)
addTopKView in class AbstractTextAnnotationviewName - The name of the new view to be added.view - The top K views@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void addViews(String[] viewNames, View[] views)
addViews in class AbstractTextAnnotation@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void addView(String viewName, View view)
AbstractTextAnnotationviewName.addView in class AbstractTextAnnotation@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void removeView(String viewName)
AbstractTextAnnotationremoveView in class AbstractTextAnnotation@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void removeAllViews()
removeAllViews in class AbstractTextAnnotation@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void setTokens(String[] tokens, IntPair[] tokenCharacterOffsets)
AbstractTextAnnotation
NOTE: This function should not be called by any method that is not a Tokenizer
and will throw an exception if tokens are set more than once. So do not call this function
unless you know what you are doing.
setTokens in class AbstractTextAnnotationtokens - An array of tokenstokenCharacterOffsets - An array, whose length is the same as tokens. Each
element indicates the character offset of this token in the raw text.Copyright © 2017. All rights reserved.