Package com.yahoo.text.interpretation
Class Annotations
- java.lang.Object
-
- com.yahoo.text.interpretation.Annotations
-
public class Annotations extends Object
An annotation is a description of a an area of text, with a given class. For example, an annotation for the- Author:
- Arne Bergene Fossaa
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>
annotations
-
Constructor Summary
Constructors Constructor Description Annotations(Span span)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
get(String key)
Boolean
getBoolean(String key)
Helper function to get a Boolean annotation.Double
getDouble(String key)
Helper function to get a Double annotation.Integer
getInteger(String key)
Helper function to get a Double annotation.Map<String,Object>
getMap()
Span
getSpan()
The span that this annotation is for.String
getString(String key)
Helper function to get a String from the Annotation.String
getSubString()
The text this annotation is for.void
put(String key, Object o)
Adds an annotation to the the the set of annotations.
-
-
-
Constructor Detail
-
Annotations
public Annotations(Span span)
-
-
Method Detail
-
getSpan
public Span getSpan()
The span that this annotation is for.
-
getSubString
public String getSubString()
The text this annotation is for.
-
getDouble
public Double getDouble(String key)
Helper function to get a Double annotation.This function first checks if the Object in a map is a
Number
, and then calls doubleValue() on it If it is not, then Double.parseDouble() is called on the string representation of the object. If the string is not parseable as a double, a NumberFormatException is thrown.
-
getString
public String getString(String key)
Helper function to get a String from the Annotation. This function will simply calltoString()
on the object saved in the Annotation or return null if the object is null;
-
getInteger
public Integer getInteger(String key)
Helper function to get a Double annotation.This function first checks if the Object in a map is a
Number
, and intValue() is called on it. If it is not, then Double.parseDouble() is called on the string representation of the object. If the string is not parseable as a double, a NumberFormatException is thrown.
-
-