public class Interpretation extends Object
Span
Modifier and Type | Field and Description |
---|---|
static AnnotationClass |
INTERPRETATION_CLASS |
private Modification |
modification |
private double |
probability |
private Span |
rootSpan |
Constructor and Description |
---|
Interpretation(Modification modification)
Creates a new interpretation based on the modification, with the probability set to the default value(0.0).
|
Interpretation(Modification modification,
double probability)
Creates an interpretation based on the modification given.
|
Interpretation(String text)
Creates a new interpretation and a new modification from the text,
with the probability set to the default value(0.0).
|
Interpretation(String text,
double probabilty)
Creates a new interpretation and a new modification from the text, with the given probability.
|
Modifier and Type | Method and Description |
---|---|
Annotations |
annotate(AnnotationClass annotationClass)
Return the annotation with the given annotationclass (and create it if necessary).
|
void |
annotate(AnnotationClass annotationClass,
String key,
Object value)
Sets a key/value pair for an annotation.
|
Annotations |
annotate(int from,
int to,
AnnotationClass annotationClass)
Returns the annotation with the given annotationClass (and create it if necessary).
|
void |
annotate(int from,
int to,
AnnotationClass annotationClass,
String key,
Object value)
Sets a key/value pair for an annotation of a substring.
|
Annotations |
annotate(int from,
int to,
String annotationClass)
Returns the annotation with the given annotationClass (and create it if necessary).
|
void |
annotate(int from,
int to,
String annotationClass,
String key,
Object value)
Sets a key/value pair for an annotation of a substring.
|
Annotations |
annotate(String annotationClass)
Return the annotation with the given annotationclass (and create it if necessary).
|
void |
annotate(String annotationClass,
String key,
Object value)
Sets a key/value pair for an annotation.
|
private void |
dumpAnnotation(StringBuilder sb,
Annotations annotations) |
Annotations |
get(AnnotationClass annotationClass)
Returns the annotation marked with the annotationClass.
|
Object |
get(AnnotationClass annotationClass,
String key)
Gets the value of a property set on an annotation.
|
Annotations |
get(int from,
int to,
AnnotationClass annotationClass)
Gets an annotation that is set on a substring.
|
Annotations |
get(int from,
int to,
String annotationClass)
Equivalent to
get(from,to,new AnnotationClass(annotationClass)) |
Object |
get(int from,
int to,
String annotationClass,
String key)
Get the value of a property set on a substring annotation.
|
Annotations |
get(String annotationClass)
Returns the annotation marked with the annotationClass.
|
Object |
get(String annotationClass,
String key)
Gets the value of a property set on an annotation.
|
Map<AnnotationClass,List<Annotations>> |
getAll()
Gets all annotations mentioned in the query.
|
List<Annotations> |
getAll(AnnotationClass annotationClass)
Returns a list of all annotations of the given class that exists in the text.
|
List<Annotations> |
getAll(String annotationClass)
Returns a list of all annotations of the given class that exists in the text.
|
Set<AnnotationClass> |
getClasses()
Gets all the annotationclasses that describes the text.
|
Set<AnnotationClass> |
getClasses(int from,
int to)
Gets all annotationclasses that describe a substring
|
Modification |
getModification() |
double |
getProbability()
The probability that this interpretation is correct.
|
List<Span> |
getTermSpans(String term)
Returns all spans that consists of the term given.
|
List<Span> |
getTokens()
Gets the lowermost spans (usually the spans marked with token).
|
Span |
root()
Returns the root of the tree representation of the interpretation
|
void |
setProbability(double probability)
Sets he probability that this interpretation is the correct.
|
String |
toString() |
private Modification modification
private double probability
private Span rootSpan
public static final AnnotationClass INTERPRETATION_CLASS
public Interpretation(String text)
public Interpretation(String text, double probabilty)
public Interpretation(Modification modification)
public Interpretation(Modification modification, double probability)
public Modification getModification()
public double getProbability()
public void setProbability(double probability)
public Span root()
public Annotations annotate(String annotationClass)
annotationClass
- The class of the annotationpublic Annotations annotate(AnnotationClass annotationClass)
annotationClass
- The class of the annotationpublic void annotate(String annotationClass, String key, Object value)
annotationClass
- class of the annotationkey
- key of the property to set on the annotationvalue
- value of the property to set on the annotationpublic void annotate(AnnotationClass annotationClass, String key, Object value)
annotationClass
- class of the annotationkey
- key of the property to set on the annotationvalue
- value of the property to set on the annotationpublic Annotations annotate(int from, int to, String annotationClass)
from
- start of the substringto
- end of the substringannotationClass
- class of the annotationpublic Annotations annotate(int from, int to, AnnotationClass annotationClass)
from
- start of the substringto
- end of the substringannotationClass
- class of the annotationpublic void annotate(int from, int to, String annotationClass, String key, Object value)
from
- start of the substringto
- end of the substringannotationClass
- class of the annotationkey
- key of property to set on annotationvalue
- value of property to set on annotationpublic void annotate(int from, int to, AnnotationClass annotationClass, String key, Object value)
from
- start of the substringto
- end of the substringannotationClass
- class of the annotationkey
- key of property to set on annotationvalue
- value of property to set on annotationpublic Map<AnnotationClass,List<Annotations>> getAll()
public List<Annotations> getAll(String annotationClass)
public List<Annotations> getAll(AnnotationClass annotationClass)
public Annotations get(String annotationClass)
annotationClass
- class of the annotationpublic Annotations get(AnnotationClass annotationClass)
annotationClass
- class of the annotationpublic Object get(String annotationClass, String key)
public Object get(AnnotationClass annotationClass, String key)
public Annotations get(int from, int to, String annotationClass)
get(from,to,new AnnotationClass(annotationClass))
public Annotations get(int from, int to, AnnotationClass annotationClass)
from
- start of the substringto
- end of the substringannotationClass
- class of the annotationpublic Object get(int from, int to, String annotationClass, String key)
public Set<AnnotationClass> getClasses()
public Set<AnnotationClass> getClasses(int from, int to)
public List<Span> getTokens()
public List<Span> getTermSpans(String term)
private void dumpAnnotation(StringBuilder sb, Annotations annotations)
Copyright © 2018. All rights reserved.