public interface AnnotatorService
Modifier and Type | Method and Description |
---|---|
void |
addAnnotator(Annotator annotator)
Add a new
Annotator to the service. |
boolean |
addView(TextAnnotation ta,
String viewName)
The standard way of adding a specific
View to a
TextAnnotation . |
TextAnnotation |
annotateTextAnnotation(TextAnnotation ta,
boolean replaceExistingViews)
Add the specified views to the TextAnnotation argument.
|
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text)
A convenience method for creating a
TextAnnotation and adding
all the View s supported by
this AnnotatorService . |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Set<String> viewNames)
An overloaded version of
createAnnotatedTextAnnotation(String, String, String) that
adds only the View s
requested. |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Tokenizer.Tokenization tokenization)
A convenience method for creating a
TextAnnotation and adding
all the View s supported by
this AnnotatorService . |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Tokenizer.Tokenization tokenization,
Set<String> viewNames)
An overloaded version of
createAnnotatedTextAnnotation(String, String, String, Tokenizer.Tokenization) that
adds only the View s
requested. |
TextAnnotation |
createBasicTextAnnotation(String corpusId,
String docId,
String text)
A convenience method for creating a
TextAnnotation . |
TextAnnotation |
createBasicTextAnnotation(String corpusId,
String docId,
String text,
Tokenizer.Tokenization tokenization)
A convenience method for creating a
TextAnnotation while
respecting the pre-tokenization of text passed in the form of
Tokenizer.Tokenization . |
Set<String> |
getAvailableViews()
Return a set containing the names of all
View s
that this service can provide. |
TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text) throws AnnotatorException
TextAnnotation
. Typically,
this will be accomplished using a TextAnnotationBuilder
.text
- The raw text used to build the
TextAnnotation
where all the View
s
should be added.AnnotatorException
- If this service cannot provide this viewName
TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
TextAnnotation
while
respecting the pre-tokenization of text passed in the form of
Tokenizer.Tokenization
.text
- The raw texttokenization
- An instance of
Tokenizer.Tokenization
which contains
tokens, character offsets, and sentence boundaries to be used while constructing the
TextAnnotation
.AnnotatorException
- If the service cannot create requested objectTextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text) throws AnnotatorException
TextAnnotation
and adding
all the View
s supported by
this AnnotatorService
. This amounts to calling
createBasicTextAnnotation(String, String, String)
and successive calls of
addView(TextAnnotation, String)
text
- The raw text used to build the
TextAnnotation
where all the View
s
should be added.AnnotatorException
- If none of the viewProviders
supports this
viewName
TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
TextAnnotation
and adding
all the View
s supported by
this AnnotatorService
. This amounts to calling
createBasicTextAnnotation(String, String, String, Tokenizer.Tokenization)
and
successive calls of
addView(TextAnnotation, String)
text
- The raw texttokenization
- An instance of
Tokenizer.Tokenization
which contains
tokens, character offsets, and sentence boundaries to be used while constructing the
TextAnnotation
.AnnotatorException
- If none of the viewProviders
supports this
viewName
TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Set<String> viewNames) throws AnnotatorException
createAnnotatedTextAnnotation(String, String, String)
that
adds only the View
s
requested.text
- The raw text used to build the
TextAnnotation
where all the View
s
should be added.viewNames
- Views to addAnnotatorException
- If none of the viewProviders
supports this
viewName
TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization, Set<String> viewNames) throws AnnotatorException
createAnnotatedTextAnnotation(String, String, String, Tokenizer.Tokenization)
that
adds only the View
s
requested.text
- The raw texttokenization
- An instance of
Tokenizer.Tokenization
which contains
tokens, character offsets, and sentence boundaries to be used while constructing the
TextAnnotation
.viewNames
- Views to addAnnotatorException
- If none of the viewProviders
supports this
viewName
boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException
View
to a
TextAnnotation
.ta
- The
TextAnnotation
where the View
should be added.viewName
- The name of the
View
to be added.
By convention this has to be a constant in
ViewNames
.AnnotatorException
- If this AnnotatorService cannot provide this viewName
,void addAnnotator(Annotator annotator) throws AnnotatorException
Annotator
to the service. All prerequisite views must already be provided by other annotators
known to this AnnotatorService
.annotator
- the Annotator
to be added.{@link
- AnnotatorException} if the annotator requires views that cannot be satisfied.AnnotatorException
Set<String> getAvailableViews()
View
s
that this service can provide.TextAnnotation annotateTextAnnotation(TextAnnotation ta, boolean replaceExistingViews) throws AnnotatorException
ta
- The TextAnnotation
to annotatereplaceExistingViews
- if 'true', annotate a
View
even if
it is already present in the ta argument, replacing the original corresponding View.AnnotatorException
Copyright © 2017. All rights reserved.