Package opennlp.uima.util
Class AnnotatorUtil
java.lang.Object
opennlp.uima.util.AnnotatorUtil
Provides utility methods for Annotators.
- 
Method SummaryModifier and TypeMethodDescriptionstatic DictionarycreateOptionalDictionary(org.apache.uima.UimaContext context, String dictionaryParameter) Creates aDictionaryvia the givenUimaContext.static BooleangetOptionalBooleanParameter(org.apache.uima.UimaContext context, String parameter) Retrieves an optional parameter from the givenUimaContext.static org.apache.uima.cas.FeaturegetOptionalFeature(org.apache.uima.cas.Type type, String featureName, String rangeType) Retrieves an optionalfeature parameterof specified type.static org.apache.uima.cas.FeaturegetOptionalFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type nameType, String featureNameParameter, String rangeTypeName) Retrieves an optionalfeature parameterof specified type.static FloatgetOptionalFloatParameter(org.apache.uima.UimaContext context, String parameter) Retrieves an optional parameter from the givenUimaContext.static IntegergetOptionalIntegerParameter(org.apache.uima.UimaContext context, String parameter) Retrieves an optional parameter from the givenUimaContext.static InputStreamgetOptionalResourceAsStream(org.apache.uima.UimaContext context, String name) Opens anInputStreamfor an optional resource via the givenUimaContext.static String[]getOptionalStringArrayParameter(org.apache.uima.UimaContext context, String parameter) Retrieves an optional parameter array from the givenUimaContext.static StringgetOptionalStringParameter(org.apache.uima.UimaContext context, String parameter) Retrieves an optional parameter from the givenUimaContext.static org.apache.uima.cas.TypegetOptionalTypeParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.TypeSystem typeSystem, String parameter) Retrieves an optionalfeature parameterof specified type.static BooleangetRequiredBooleanParameter(org.apache.uima.UimaContext context, String parameter) Retrieves a required parameter from the given context.static org.apache.uima.cas.FeaturegetRequiredFeature(org.apache.uima.cas.Type type, String featureName) Retrieves aFeaturefor a specified type andfeatureName, otherwise an exception is thrown.static org.apache.uima.cas.FeaturegetRequiredFeature(org.apache.uima.cas.Type type, String featureName, String rangeType) Retrieves aFeatureof the given type.static org.apache.uima.cas.FeaturegetRequiredFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type type, String featureNameParameter) Retrieves afeature parameterof specified type.static org.apache.uima.cas.FeaturegetRequiredFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type type, String featureNameParameter, String rangeTypeName) Retrieves afeature parameterof specified type.static FloatgetRequiredFloatParameter(org.apache.uima.UimaContext context, String parameter) Retrieves a required parameter from the given context.static IntegergetRequiredIntegerParameter(org.apache.uima.UimaContext context, String parameter) Retrieves a required parameter from the given context.static StringgetRequiredStringParameter(org.apache.uima.UimaContext context, String parameter) Retrieves a required parameter from the given context.static org.apache.uima.cas.TypegetRequiredTypeParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.TypeSystem typeSystem, String parameter) Retrieves a type of the given name from the given type system.static InputStreamgetResourceAsStream(org.apache.uima.UimaContext context, String name) Opens anInputStreamfor a resource via the givenUimaContext.static org.apache.uima.cas.TypeRetrieves a type of the given name from the given type system.
- 
Method Details- 
getTypepublic static org.apache.uima.cas.Type getType(org.apache.uima.cas.TypeSystem typeSystem, String name) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves a type of the given name from the given type system.- Parameters:
- typeSystem- The- TypeSystemto use.
- name- The name of the type to retrieve.
- Returns:
- The Typefor thename.
- Throws:
- IllegalArgumentException- Thrown if parameters were invalid.
- OpenNlpAnnotatorProcessException- Thrown if no- Typecould be found.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredFeaturepublic static org.apache.uima.cas.Feature getRequiredFeature(org.apache.uima.cas.Type type, String featureName) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves aFeaturefor a specified type andfeatureName, otherwise an exception is thrown.- Parameters:
- type- The- Typeto use.
- featureName- The name of the feature to retrieve.
- Returns:
- The Featureif found.
- Throws:
- IllegalArgumentException- Thrown if parameters were invalid.
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredFeaturepublic static org.apache.uima.cas.Feature getRequiredFeature(org.apache.uima.cas.Type type, String featureName, String rangeType) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves aFeatureof the given type.- Parameters:
- type- The- Typeto use.
- featureName- The name of the feature to retrieve.
- rangeType- The expected range type.
- Returns:
- The Featureif found.
- Throws:
- IllegalArgumentException- Thrown if parameters were invalid.
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredFeatureParameterpublic static org.apache.uima.cas.Feature getRequiredFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type type, String featureNameParameter) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves afeature parameterof specified type.- Parameters:
- context- The- UimaContextto use.
- type- The- Typeof the- Featureto get.
- featureNameParameter- The name of the feature parameter.
- Returns:
- The Featureif found.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredFeatureParameterpublic static org.apache.uima.cas.Feature getRequiredFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type type, String featureNameParameter, String rangeTypeName) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves afeature parameterof specified type.- Parameters:
- context- The- UimaContextto use.
- type- The- Typeof the- Featureto get.
- featureNameParameter- The name of the feature parameter.
- rangeTypeName- The name of expected range type.
- Returns:
- The Featureif found.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredTypeParameterpublic static org.apache.uima.cas.Type getRequiredTypeParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.TypeSystem typeSystem, String parameter) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves a type of the given name from the given type system.- Parameters:
- context- The- UimaContextto use.
- typeSystem- The- TypeSystemto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Typefor thename.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Typecould be found.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getRequiredStringParameterpublic static String getRequiredStringParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves a required parameter from the given context.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Stringvalue retrieved for a specifiedparameterfrom thecontext.
- Throws:
- org.apache.uima.resource.ResourceInitializationException
 
- 
getRequiredIntegerParameterpublic static Integer getRequiredIntegerParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves a required parameter from the given context.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Integervalue retrieved for a specifiedparameterfrom thecontext.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if no value} could be found.
 
- 
getRequiredFloatParameterpublic static Float getRequiredFloatParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves a required parameter from the given context.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Floatvalue retrieved for a specifiedparameterfrom thecontext.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if no value} could be found.
 
- 
getRequiredBooleanParameterpublic static Boolean getRequiredBooleanParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves a required parameter from the given context.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Booleanvalue retrieved for a specifiedparameterfrom thecontext.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if no value} could be found.
 
- 
getOptionalFeatureParameterpublic static org.apache.uima.cas.Feature getOptionalFeatureParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.Type nameType, String featureNameParameter, String rangeTypeName) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves an optionalfeature parameterof specified type.- Parameters:
- context- The- UimaContextto use.
- nameType- The- Typeof the- Featureto get.
- featureNameParameter- The name of the feature parameter.
- rangeTypeName- The name of expected range type.
- Returns:
- The Featureif found.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getOptionalFeaturepublic static org.apache.uima.cas.Feature getOptionalFeature(org.apache.uima.cas.Type type, String featureName, String rangeType) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves an optionalfeature parameterof specified type.- Parameters:
- type- The- Typeof the- Featureto get.
- featureName- The name of the feature parameter.
- rangeType- The expected range type.
- Returns:
- The Featureif found.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Featuredid match.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getOptionalTypeParameterpublic static org.apache.uima.cas.Type getOptionalTypeParameter(org.apache.uima.UimaContext context, org.apache.uima.cas.TypeSystem typeSystem, String parameter) throws org.apache.uima.analysis_engine.AnalysisEngineProcessException Retrieves an optionalfeature parameterof specified type.- Parameters:
- context- The- UimaContextto use.
- typeSystem- The- TypeSystemto use.
- parameter- The name of the type to retrieve.
- Returns:
- The Typefor thename.
- Throws:
- OpenNlpAnnotatorProcessException- Thrown if no- Typecould be found.
- org.apache.uima.analysis_engine.AnalysisEngineProcessException
 
- 
getOptionalStringParameterpublic static String getOptionalStringParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves an optional parameter from the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the parameter to retrieve.
- Returns:
- The parameterornullif not set.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the parameter type was not of the expected type.
 
- 
getOptionalStringArrayParameterpublic static String[] getOptionalStringArrayParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves an optional parameter array from the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the parameter to retrieve.
- Returns:
- The parameter arrayor an empty array if not set.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the parameter type was not of the expected type.
 
- 
getOptionalIntegerParameterpublic static Integer getOptionalIntegerParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves an optional parameter from the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the parameter to retrieve.
- Returns:
- The parameterornullif not set.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the parameter type was not of the expected type.
 
- 
getOptionalFloatParameterpublic static Float getOptionalFloatParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves an optional parameter from the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the parameter to retrieve.
- Returns:
- The parameterornullif not set.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the parameter type was not of the expected type.
 
- 
getOptionalBooleanParameterpublic static Boolean getOptionalBooleanParameter(org.apache.uima.UimaContext context, String parameter) throws org.apache.uima.resource.ResourceInitializationException Retrieves an optional parameter from the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- parameter- The name of the parameter to retrieve.
- Returns:
- The parameterornullif not set.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the parameter type was not of the expected type.
 
- 
getResourceAsStreampublic static InputStream getResourceAsStream(org.apache.uima.UimaContext context, String name) throws org.apache.uima.resource.ResourceInitializationException Opens anInputStreamfor a resource via the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- name- The name that identifies the resource.
- Returns:
- A valid, open InputStream.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the resource could not be found.
 
- 
getOptionalResourceAsStreampublic static InputStream getOptionalResourceAsStream(org.apache.uima.UimaContext context, String name) throws org.apache.uima.resource.ResourceInitializationException Opens anInputStreamfor an optional resource via the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- name- The name that identifies the resource.
- Returns:
- A valid, open InputStream.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the resource could not be found.
 
- 
createOptionalDictionarypublic static Dictionary createOptionalDictionary(org.apache.uima.UimaContext context, String dictionaryParameter) throws org.apache.uima.resource.ResourceInitializationException Creates aDictionaryvia the givenUimaContext.- Parameters:
- context- The- UimaContextto use.
- dictionaryParameter- The name that identifies the dictionary.
- Returns:
- A valid Dictionaryornullif IO errors occurred.
- Throws:
- org.apache.uima.resource.ResourceInitializationException- Thrown if the resource could not be found.
 
 
-