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, select
protected TextAnnotation textAnnotation
protected Constituent sentenceConstituent
protected static final ITransformer<View,Double> defaultViewScoreSplitter
public Sentence(Constituent sentenceConstituent)
public int getEndSpan()
public View getView(String viewName)
AbstractTextAnnotation
viewName
.getView
in class AbstractTextAnnotation
public boolean hasView(String viewName)
AbstractTextAnnotation
viewName
hasView
in class AbstractTextAnnotation
true
if the text annotation contains a view called viewName
and
false
otherwisepublic Constituent getSentenceConstituent()
public int getStartSpan()
public List<View> getTopKViews(String viewName)
AbstractTextAnnotation
viewName
getTopKViews
in class AbstractTextAnnotation
public String[] getTokens()
AbstractTextAnnotation
getTokens
in class AbstractTextAnnotation
public int size()
AbstractTextAnnotation
size
in class AbstractTextAnnotation
public String getText()
AbstractTextAnnotation
getText
in class AbstractTextAnnotation
public String getTokenizedText()
AbstractTextAnnotation
getTokenizedText
in class AbstractTextAnnotation
public String getToken(int position)
AbstractTextAnnotation
getToken
in class AbstractTextAnnotation
public 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 AbstractTextAnnotation
viewName
- 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)
AbstractTextAnnotation
viewName
.addView
in class AbstractTextAnnotation
@AvoidUsing(reason="Sentence class is read-only. Edit the source TextAnnotation instance directly.") public void removeView(String viewName)
AbstractTextAnnotation
removeView
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 AbstractTextAnnotation
tokens
- 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.