public class CuratorAnnotatorService extends Object implements AnnotatorService
AnnotatorService object with most of the
annotators available in CCG Curator.
Do not call this class directly; instead, use
CuratorFactory
TODO Until a caching mechanism is available in illinois-core-utilities, this AnnotatorService will not support caching
| Modifier and Type | Field and Description |
|---|---|
protected TextAnnotationCache |
annotationCache |
| Modifier | Constructor and Description |
|---|---|
protected |
CuratorAnnotatorService()
Overloaded constructor with default configuration.
|
protected |
CuratorAnnotatorService(ResourceManager rm)
|
| 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 Views supported by
this AnnotatorService. |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Set<String> viewNames)
An overloaded version of
AnnotatorService.createAnnotatedTextAnnotation(String, String, String) that
adds only the Views
requested. |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Tokenizer.Tokenization tokenization)
A convenience method for creating a
TextAnnotation and adding
all the Views supported by
this AnnotatorService. |
TextAnnotation |
createAnnotatedTextAnnotation(String corpusId,
String textId,
String text,
Tokenizer.Tokenization tokenization,
Set<String> viewNames)
An overloaded version of
AnnotatorService.createAnnotatedTextAnnotation(String, String, String, Tokenizer.Tokenization) that
adds only the Views
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
Views
that this service can provide. |
protected TextAnnotationCache annotationCache
protected CuratorAnnotatorService()
throws Exception
ExceptionCuratorAnnotatorService(ResourceManager)protected CuratorAnnotatorService(ResourceManager rm)
AnnotatorService object that contains
all Curator components under
ViewNames. (to access the rest of the
Curator annotators, you will need to requrest it manually, by altering
CuratorClient.addRecordViewFromCurator(java.lang.String, java.util.List<java.lang.String>, java.lang.String)).
Each Curator internal component is wrapped in a
CuratorAnnotator that automates the retrieval of
requiredViews and viewName. The current set of components is built using the
dependencies and view names found in
/shared/trollope/curator/dist/configs/annotators-trollope.xml, Mar 12 09:12.
rm - ResourceManager with properties for the
CuratorClient and caching behaviorpublic TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text) throws AnnotatorException
AnnotatorServiceTextAnnotation. Typically,
this will be accomplished using a TextAnnotationBuilder.createBasicTextAnnotation in interface AnnotatorServicetext - The raw text used to build the
TextAnnotation
where all the Views
should be added.AnnotatorException - If this service cannot provide this viewNamepublic TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
AnnotatorServiceTextAnnotation while
respecting the pre-tokenization of text passed in the form of
Tokenizer.Tokenization.createBasicTextAnnotation in interface AnnotatorServicetext - 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 objectpublic TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text) throws AnnotatorException
AnnotatorServiceTextAnnotation and adding
all the Views supported by
this AnnotatorService. This amounts to calling
AnnotatorService.createBasicTextAnnotation(String, String, String) and successive calls of
AnnotatorService.addView(TextAnnotation, String)createAnnotatedTextAnnotation in interface AnnotatorServicetext - The raw text used to build the
TextAnnotation
where all the Views
should be added.AnnotatorException - If none of the viewProviders supports this
viewNamepublic TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
AnnotatorServiceTextAnnotation and adding
all the Views supported by
this AnnotatorService. This amounts to calling
AnnotatorService.createBasicTextAnnotation(String, String, String, Tokenizer.Tokenization) and
successive calls of
AnnotatorService.addView(TextAnnotation, String)createAnnotatedTextAnnotation in interface AnnotatorServicetext - 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
viewNamepublic TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Set<String> viewNames) throws AnnotatorException
AnnotatorServiceAnnotatorService.createAnnotatedTextAnnotation(String, String, String) that
adds only the Views
requested.createAnnotatedTextAnnotation in interface AnnotatorServicetext - The raw text used to build the
TextAnnotation
where all the Views
should be added.viewNames - Views to addAnnotatorException - If none of the viewProviders supports this
viewNamepublic TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization, Set<String> viewNames) throws AnnotatorException
AnnotatorServiceAnnotatorService.createAnnotatedTextAnnotation(String, String, String, Tokenizer.Tokenization) that
adds only the Views
requested.createAnnotatedTextAnnotation in interface AnnotatorServicetext - 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
viewNamepublic boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException
AnnotatorServiceView to a
TextAnnotation.addView in interface AnnotatorServiceta - 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,public void addAnnotator(Annotator annotator) throws AnnotatorException
Annotator to the service. All prerequisite views must already be provided by other annotators
known to this AnnotatorService.addAnnotator in interface AnnotatorServiceannotator - the Annotator to be added.{@link - AnnotatorException} if the annotator requires views that cannot be satisfied.AnnotatorExceptionpublic Set<String> getAvailableViews()
Views
that this service can provide.getAvailableViews in interface AnnotatorServicepublic TextAnnotation annotateTextAnnotation(TextAnnotation ta, boolean replaceExistingViews) throws AnnotatorException
annotateTextAnnotation in interface AnnotatorServiceta - The TextAnnotation to annotatereplaceExistingViews - ignored by this AnnotatorServiceAnnotatorExceptionCopyright © 2017. All rights reserved.