Class AnnotatorUtil


  • public final class AnnotatorUtil
    extends Object
    This is a utility class for Annotators.
    • Method Detail

      • getType

        public 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 -
        name -
        Returns:
        the type
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredFeature

        public static org.apache.uima.cas.Feature getRequiredFeature​(org.apache.uima.cas.Type type,
                                                                     String featureName)
                                                              throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredFeature

        public 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 a required feature from the given type.
        Parameters:
        type - the type
        featureName - the name of the feature
        rangeType - the expected range type
        Returns:
        the requested parameter
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredFeatureParameter

        public 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
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredFeatureParameter

        public 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
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredTypeParameter

        public 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
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getRequiredStringParameter

        public 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 -
        parameter -
        Returns:
        the requested parameter
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getRequiredIntegerParameter

        public 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 -
        parameter -
        Returns:
        the requested parameter
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getRequiredFloatParameter

        public 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 -
        parameter -
        Returns:
        the requested parameter
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getRequiredBooleanParameter

        public 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 -
        parameter -
        Returns:
        the requested parameter
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalFeatureParameter

        public 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
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getOptionalFeature

        public static org.apache.uima.cas.Feature getOptionalFeature​(org.apache.uima.cas.Type type,
                                                                     String featureName,
                                                                     String rangeType)
                                                              throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getOptionalTypeParameter

        public 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
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • getOptionalStringParameter

        public static String getOptionalStringParameter​(org.apache.uima.UimaContext context,
                                                        String parameter)
                                                 throws org.apache.uima.resource.ResourceInitializationException
        Retrieves an optional parameter from the given context.
        Parameters:
        context -
        parameter -
        Returns:
        the parameter or null if not set
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalStringArrayParameter

        public static String[] getOptionalStringArrayParameter​(org.apache.uima.UimaContext context,
                                                               String parameter)
                                                        throws org.apache.uima.resource.ResourceInitializationException
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalIntegerParameter

        public static Integer getOptionalIntegerParameter​(org.apache.uima.UimaContext context,
                                                          String parameter)
                                                   throws org.apache.uima.resource.ResourceInitializationException
        Retrieves an optional parameter from the given context.
        Parameters:
        context -
        parameter -
        Returns:
        the parameter or null if not set
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalFloatParameter

        public static Float getOptionalFloatParameter​(org.apache.uima.UimaContext context,
                                                      String parameter)
                                               throws org.apache.uima.resource.ResourceInitializationException
        Retrieves an optional parameter from the given context.
        Parameters:
        context -
        parameter -
        Returns:
        the parameter or null if not set
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalBooleanParameter

        public static Boolean getOptionalBooleanParameter​(org.apache.uima.UimaContext context,
                                                          String parameter)
                                                   throws org.apache.uima.resource.ResourceInitializationException
        Retrieves an optional parameter from the given context.
        Parameters:
        context -
        parameter -
        Returns:
        the parameter or null if not set
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getResourceAsStream

        public static InputStream getResourceAsStream​(org.apache.uima.UimaContext context,
                                                      String name)
                                               throws org.apache.uima.resource.ResourceInitializationException
        Retrieves a resource as stream from the given context.
        Parameters:
        context -
        name -
        Returns:
        the stream
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • getOptionalResourceAsStream

        public static InputStream getOptionalResourceAsStream​(org.apache.uima.UimaContext context,
                                                              String name)
                                                       throws org.apache.uima.resource.ResourceInitializationException
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • createOptionalDictionary

        public static opennlp.tools.dictionary.Dictionary createOptionalDictionary​(org.apache.uima.UimaContext context,
                                                                                   String dictionaryParameter)
                                                                            throws org.apache.uima.resource.ResourceInitializationException
        Throws:
        org.apache.uima.resource.ResourceInitializationException