@AvoidUsing(reason="This is no longer the recommended way of calling Curator", alternative="CuratorAnnotatorService") public class CuratorClient extends Object
CuratorClient
will still be able to
provide TextAnnotation
s and
View
s, the canonical
way to access the Curator
is now through the CuratorAnnotatorService
(which
creates a AnnotatorService
object).
A client for using the Curator to get
TextAnnotation
s.
The general use case involves the following:
CuratorClient
{ @code // Assuming we're starting from raw text ResourceManager rm = new CuratorConfigurator().getDefaultConfig(); CuratorClient curator = new CuratorClient(rm); }
TextAnnotation
{ @code TextAnnotation ta = client.getTextAnnotation(text); }
TextAnnotation
using the
required view's name (supported views can be found in
ViewNames
.
client.addTextAnnotationView(ta, ViewNames.POS);
Constructor and Description |
---|
CuratorClient(ResourceManager rm)
Create a new curator client pointing to the specified host and port.
|
Modifier and Type | Method and Description |
---|---|
TextAnnotation |
getTextAnnotation(String corpusId,
String textId,
String text)
|
View |
getTextAnnotationView(TextAnnotation ta,
String viewName) |
public CuratorClient(ResourceManager rm)
ViewNames
for the various annotators when
calling the curator.rm
- The ResourceManager
containing the properties for Curatorpublic TextAnnotation getTextAnnotation(String corpusId, String textId, String text) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException, SocketException
TextAnnotation
for the
specified text
belonging to the corpusId
with id textId
. This method
calls the Curator to get the tokenization and the sentences unless the CuratorClient's
respectTokenization
field is set to true
, in which case it generates
sentence and label views based on newlines and whitespace characters. (NB: tabs will
be treated as tokens!) Consecutive whitespace characters will not generate empty tokens, but
the token offsets and sentence offsets will count all whitespace characters.
Note: The Record
returned by this method will not have any views except the
Sentence
and Token
view. To get other views from the Curator, call the
appropriate CuratorClient
functions (e.g TODO).
corpusId
- Identifier for the corpustextId
- Identifier for the texttext
- The raw textTextAnnotation
with
ViewNames.TOKENS
and
ViewNames.SENTENCE
views.edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
SocketException
public View getTextAnnotationView(TextAnnotation ta, String viewName) throws org.apache.thrift.TException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, SocketException
org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
SocketException
Copyright © 2017. All rights reserved.