Class CasAnnotator_ImplBase

  • All Implemented Interfaces:
    AnalysisComponent
    Direct Known Subclasses:
    XmlDetagger

    public abstract class CasAnnotator_ImplBase
    extends Annotator_ImplBase
    Base class to be extended by Annotators that use the CAS interface. An Annotator is an AnalysisComponent that may modify its input CAS, but never creates any new CASes as output.
    • Field Detail

      • mLastTypeSystem

        private TypeSystem mLastTypeSystem
        Stores the last type system that this component operated on, so we can tell when typeSystemInit needs to be called.
    • Constructor Detail

      • CasAnnotator_ImplBase

        public CasAnnotator_ImplBase()
    • Method Detail

      • getRequiredCasInterface

        public java.lang.Class<CAS> getRequiredCasInterface()
        Description copied from interface: AnalysisComponent
        Returns the specific CAS interface that this AnalysisComponent requires the framework to pass to its AnalysisComponent.process(AbstractCas) method.
        Returns:
        the required CAS interface. This must specify a subtype of AbstractCas.
      • process

        public abstract void process​(CAS aCAS)
                              throws AnalysisEngineProcessException
        Inputs a CAS to the AnalysisComponent. This method should be overriden by subclasses to perform analysis of the CAS.
        Parameters:
        aCAS - A CAS that this AnalysisComponent should process.
        Throws:
        AnalysisEngineProcessException - if a problem occurs during processing
      • typeSystemInit

        public void typeSystemInit​(TypeSystem aTypeSystem)
                            throws AnalysisEngineProcessException
        Informs this annotator that the CAS TypeSystem has changed. The Analysis Engine calls this from PrimitiveAnalysisEngine_impl which-calls CasAnnotator_ImplBase.process which-calls checkTypeSystemChange

        In this method, the Annotator should use the TypeSystem to resolve the names of Type and Features to the actual Type and Feature objects, which can then be used during processing.

        Parameters:
        aTypeSystem - the new type system to use as input to your initialization
        Throws:
        AnalysisEngineProcessException - if the provided type system is missing types or features required by this annotator
      • checkTypeSystemChange

        private void checkTypeSystemChange​(CAS aCAS)
                                    throws AnalysisEngineProcessException
        Checks it the type system of the given CAS is different from the last type system this component was operating on. If it is different, calls the typeSystemInit method on the component.
        Throws:
        AnalysisEngineProcessException