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 View s 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 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
AnnotatorService.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. |
protected TextAnnotationCache annotationCache
protected CuratorAnnotatorService() throws Exception
Exception
CuratorAnnotatorService(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
AnnotatorService
TextAnnotation
. Typically,
this will be accomplished using a TextAnnotationBuilder
.createBasicTextAnnotation
in interface AnnotatorService
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
public TextAnnotation createBasicTextAnnotation(String corpusId, String docId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
AnnotatorService
TextAnnotation
while
respecting the pre-tokenization of text passed in the form of
Tokenizer.Tokenization
.createBasicTextAnnotation
in interface AnnotatorService
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 objectpublic TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text) throws AnnotatorException
AnnotatorService
TextAnnotation
and adding
all the View
s supported by
this AnnotatorService
. This amounts to calling
AnnotatorService.createBasicTextAnnotation(String, String, String)
and successive calls of
AnnotatorService.addView(TextAnnotation, String)
createAnnotatedTextAnnotation
in interface AnnotatorService
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
public TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization) throws AnnotatorException
AnnotatorService
TextAnnotation
and adding
all the View
s 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 AnnotatorService
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
public TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Set<String> viewNames) throws AnnotatorException
AnnotatorService
AnnotatorService.createAnnotatedTextAnnotation(String, String, String)
that
adds only the View
s
requested.createAnnotatedTextAnnotation
in interface AnnotatorService
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
public TextAnnotation createAnnotatedTextAnnotation(String corpusId, String textId, String text, Tokenizer.Tokenization tokenization, Set<String> viewNames) throws AnnotatorException
AnnotatorService
AnnotatorService.createAnnotatedTextAnnotation(String, String, String, Tokenizer.Tokenization)
that
adds only the View
s
requested.createAnnotatedTextAnnotation
in interface AnnotatorService
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
public boolean addView(TextAnnotation ta, String viewName) throws AnnotatorException
AnnotatorService
View
to a
TextAnnotation
.addView
in interface AnnotatorService
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
,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 AnnotatorService
annotator
- the Annotator
to be added.{@link
- AnnotatorException} if the annotator requires views that cannot be satisfied.AnnotatorException
public Set<String> getAvailableViews()
View
s
that this service can provide.getAvailableViews
in interface AnnotatorService
public TextAnnotation annotateTextAnnotation(TextAnnotation ta, boolean replaceExistingViews) throws AnnotatorException
annotateTextAnnotation
in interface AnnotatorService
ta
- The TextAnnotation
to annotatereplaceExistingViews
- ignored by this AnnotatorServiceAnnotatorException
Copyright © 2017. All rights reserved.