public class CuratorClient extends Object
Modifier and Type | Field and Description |
---|---|
protected String |
curatorHost |
protected int |
curatorPort |
protected boolean |
respectTokenization |
Constructor and Description |
---|
CuratorClient(String curatorHost,
int curatorPort)
Equivalent to
CuratorClient(String, int, boolean)
with the third parameter set to false . |
CuratorClient(String curatorHost,
int curatorPort,
boolean respectTokenization)
Create a new curator client pointing to the specified host and port.
|
Modifier and Type | Method and Description |
---|---|
void |
addBerkeleyParse(TextAnnotation ta,
boolean forceUpdate)
Fetches parse trees generated by the Berkeley parser from the curator and
adds them to the
TextAnnotation that is passed as a parameter to
the function. |
void |
addCharniakParse(TextAnnotation ta,
boolean forceUpdate)
Fetches parse trees generated by the Charniak parser from the curator and
adds them to the
TextAnnotation that is passed as a parameter to
the function. |
void |
addChunkView(TextAnnotation ta,
boolean forceUpdate)
Fetches the chunk view from the curator and adds the view to the
TextAnnotation as ViewNames#SHALLOW_PARSE . |
void |
addCoreferenceView(TextAnnotation ta,
boolean forceUpdate,
String curatorViewName,
String edisonViewName)
Adds a coreference view
|
void |
addCorefView(TextAnnotation ta,
boolean forceUpdate)
Fetches the coreference view from the curator and adds it to the
TextAnnotation as ViewNames.COREF . |
void |
addDependencyTreeView(TextAnnotation ta,
boolean forceUpdate,
String curatorViewName,
String edisonViewName)
Adds a dependency tree view
|
void |
addEasyFirstDependencyView(TextAnnotation ta,
boolean forceUpdate)
Fetches the dependency trees generated by the Yoav Goldberg's parser and
adds the view to the
TextAnnotation as
ViewNames.DEPENDENCY . |
void |
addLemmaView(TextAnnotation ta,
boolean forceUpdate)
Fetches the word lemmas from the curator and adds the view to the
TextAnnotation as ViewNames.LEMMA . |
void |
addNamedEntityView(TextAnnotation ta,
boolean forceUpdate)
Fetches the named entity view from the curator and adds the view to the
TextAnnotation as ViewNames#NER . |
void |
addNOMView(TextAnnotation ta,
boolean forceUpdate)
Deprecated.
|
void |
addNumericalQuantitiesView(TextAnnotation ta,
boolean forceUpdate)
Fetches the numerical quantities view from the curator and adds the view
to the
TextAnnotation as ViewNames#QUANTITIES . |
void |
addParseTreeView(TextAnnotation ta,
boolean forceUpdate,
String treeSource,
String viewName)
Adds a parse tree view
|
void |
addPOSView(TextAnnotation ta,
boolean forceUpdate)
Fetches the part-of-speech tags from the curator and adds the view to the
TextAnnotation as ViewNames.POS . |
void |
addPredicateArgumentView(TextAnnotation ta,
boolean forceUpdate,
String curatorViewName,
String edisonViewName)
Adds a predicate argument view to the text annotation
|
void |
addSpanLabelView(TextAnnotation ta,
boolean forceUpdate,
String curatorViewName,
boolean allowOverlappingSpans,
String edisonViewName)
Adds a span-label-view
|
void |
addSRLNomView(TextAnnotation ta,
boolean forceUpdate)
Fetches the nominalization SRL_NOM view from the curator and adds it to the
TextAnnotation as ViewNames.SRL_NOM |
void |
addSRLVerbView(TextAnnotation ta,
boolean forceUpdate)
Fetches the verb SRL_VERB view from the curator and adds it to the
TextAnnotation as ViewNames.SRL_VERB |
void |
addSRLView(TextAnnotation ta,
boolean forceUpdate)
Deprecated.
|
void |
addStanfordDependencyView(TextAnnotation ta,
boolean forceUpdate)
Fetches the dependency trees generated by the Stanford parser and adds
the view to the
TextAnnotation as
ViewNames.DEPENDENCY_STANFORD . |
void |
addStanfordParse(TextAnnotation ta,
boolean forceUpdate)
Fetches parse trees generated by the Stanford parser from the curator and
adds them to the
TextAnnotation that is passed as a parameter to
the function. |
void |
addTokenLabelView(TextAnnotation ta,
boolean forceUpdate,
String curatorViewName,
String edisonViewName)
Adds a token-label-view
|
void |
addWikifierView(TextAnnotation ta,
boolean forceUpdate)
Fetches the wikifier view from the curator and adds the view to the
TextAnnotation as ViewNames#WIKIFIER . |
protected edu.illinois.cs.cogcomp.thrift.curator.Record |
getRecordFromCurator(TextAnnotation ta,
String viewName,
boolean forceUpdate)
Does the network call to the Curator and fetches a record that has a
particular view.
|
protected List<String> |
getSentenceList(TextAnnotation ta)
Generates a list of sentences from a
TextAnnotation . |
TextAnnotation |
getTextAnnotation(String corpusId,
String textId,
String text,
boolean forceUpdate)
|
static void |
main(String[] args) |
protected final String curatorHost
protected final int curatorPort
protected final boolean respectTokenization
public CuratorClient(String curatorHost, int curatorPort, boolean respectTokenization)
stanfordDep
stanfordParse
dependencies
chunk
srl
charniak
quantities
tokens
sentences
ner
coref
nom
pos
berkeley
curatorHost
- The host where the curator is running.curatorPort
- The curator's portrespectTokenization
- If this is true
, then the calls to the curator will be
prefixed with ws
, thereby asking the curator to
respect the tokenization that is present in the
TextAnnotation
s that are passed to the various
"addView" functions. Set this to true
if the data is
pre-tokenized.public CuratorClient(String curatorHost, int curatorPort)
CuratorClient(String, int, boolean)
with the third parameter set to false
. That is, the tokenization
from the curator is treated as the correct one.curatorHost
- The host where the curator is running.curatorPort
- The curator's portpublic TextAnnotation getTextAnnotation(String corpusId, String textId, String text, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
for the specified text
belonging to the corpusId
with id textId
. This method
calls the curator to get the tokenization and the sentences.
Notes:
TextAnnotation
using one of its constructors that specify the
tokenization.
TextAnnotation
returned by this method will not have any
views except the Sentence
view. To get other views from the
Curator, call the appropriate CuratorClient
functions.
corpusId
- Identifier for the corpustextId
- Identifier for the texttext
- The raw textforceUpdate
- Force the curator to update even if the record is found in the
database? (This should preferably be set to false
.)TextAnnotation
with the tokenization specified by the
Curator and whose Sentence
view has been set according to
the Curator.edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addPredicateArgumentView(TextAnnotation ta, boolean forceUpdate, String curatorViewName, String edisonViewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The input text annotationforceUpdate
- Force an update to the curator cache?curatorViewName
- The view name on CuratoredisonViewName
- The name of the view that is added to the input TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addParseTreeView(TextAnnotation ta, boolean forceUpdate, String treeSource, String viewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The text annotationforceUpdate
- Should the curator be forced to update its cache?treeSource
- The view name in the curatorviewName
- The name of the view that will be added to the input
TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addDependencyTreeView(TextAnnotation ta, boolean forceUpdate, String curatorViewName, String edisonViewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The text annotationforceUpdate
- Should the curator be forced to update its cache?curatorViewName
- The view name in the curatoredisonViewName
- The name of the view that will be added to the input
TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addTokenLabelView(TextAnnotation ta, boolean forceUpdate, String curatorViewName, String edisonViewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The text annotationforceUpdate
- Should the curator be forced to update its cache?curatorViewName
- The view name in the curatoredisonViewName
- The name of the view that will be added to the input
TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addSpanLabelView(TextAnnotation ta, boolean forceUpdate, String curatorViewName, boolean allowOverlappingSpans, String edisonViewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The text annotationforceUpdate
- Should the curator be forced to update its cache? *curatorViewName
- The view name in the curatorallowOverlappingSpans
- Should overlapping spans be allowed?edisonViewName
- The name of the view that will be added to the input
TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addCoreferenceView(TextAnnotation ta, boolean forceUpdate, String curatorViewName, String edisonViewName) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The text annotationforceUpdate
- Should the curator be forced to update its cache?curatorViewName
- The view name in the curatoredisonViewName
- The name of the view that will be added to the input
TextAnnotationedu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addCharniakParse(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
that is passed as a parameter to
the function. This function adds a view called
ViewNames.PARSE_CHARNIAK
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from parser? (Preferably
this should be false
.)edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addBerkeleyParse(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
that is passed as a parameter to
the function. This function adds a view called
ViewNames.PARSE_BERKELEY
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from parser? (Preferably
this should be false
.)edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addStanfordParse(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
that is passed as a parameter to
the function. This function adds a view called
ViewNames.PARSE_STANFORD
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?
(Preferably this should be false
.)edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addPOSView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames.POS
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addLemmaView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames.LEMMA
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addChunkView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames#SHALLOW_PARSE
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addWikifierView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames#WIKIFIER
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addNumericalQuantitiesView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames#QUANTITIES
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addNamedEntityView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames#NER
. This is different from
the other methods that add SpanLabelView
s because it uses the
longest common subsequence algorithm to align tokens to characters
because the NER doesn't necessarily respect the standard tokenization.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
public void addStanfordDependencyView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as
ViewNames.DEPENDENCY_STANFORD
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addEasyFirstDependencyView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as
ViewNames.DEPENDENCY
.ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the parser?edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addCorefView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames.COREF
.
Note: This function assumes that the longest mention (in terms of the number of characters) is the canonical mention.
ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the coref system?edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addSRLNomView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames.SRL_NOM
ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the SRL_NOM system?edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
@Deprecated public void addNOMView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public void addSRLVerbView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
TextAnnotation
as ViewNames.SRL_VERB
ta
- The TextAnnotation
forceUpdate
- Should the Curator force an update from the SRL_VERB system?edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
@Deprecated public void addSRLView(TextAnnotation ta, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
protected List<String> getSentenceList(TextAnnotation ta)
TextAnnotation
. This is used
before calling the wsprovide method for white space specified sentences.ta
- The TextAnnotation
protected edu.illinois.cs.cogcomp.thrift.curator.Record getRecordFromCurator(TextAnnotation ta, String viewName, boolean forceUpdate) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
ta
- The TextAnnotation
viewName
- The view to get (according to the Curator lingo.)forceUpdate
- Should the curator force an update of the database?Record
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
public static void main(String[] args) throws edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException, edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException, org.apache.thrift.TException
edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException
edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException
org.apache.thrift.TException
Copyright © 2015. All rights reserved.