Class POSAnnotator

  • All Implemented Interfaces:
    org.apache.uima.analysis_component.AnalysisComponent

    public class POSAnnotator
    extends org.apache.uima.analysis_component.JCasAnnotator_ImplBase
    • Constructor Summary

      Constructors 
      Constructor Description
      POSAnnotator()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Sentence createUnitSentence​(ArrayList<de.julielab.jcore.types.Token> tokenList, org.apache.uima.jcas.JCas JCas)
      Takes all info about meta data and generates the corresponding unit sequence represented by a Sentence object.
      void initialize​(org.apache.uima.UimaContext aContext)
      Initialisiation of UIMA-JNET.
      void process​(org.apache.uima.jcas.JCas aJCas)
      process current CAS.
      void writeToCAS​(Sentence unitSentence, org.apache.uima.jcas.JCas aJCas, ArrayList<de.julielab.jcore.types.Token> tokenList)
      creates the respective uima annotations from JPOS's predictions.
      • Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase

        getRequiredCasInterface, process
      • Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase

        getCasInstancesRequired, hasNext, next
      • Methods inherited from class org.apache.uima.analysis_component.AnalysisComponent_ImplBase

        batchProcessComplete, collectionProcessComplete, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification
    • Constructor Detail

      • POSAnnotator

        public POSAnnotator()
    • Method Detail

      • initialize

        public void initialize​(org.apache.uima.UimaContext aContext)
                        throws org.apache.uima.resource.ResourceInitializationException
        Initialisiation of UIMA-JNET. Reads in and checks descriptor's parameters.
        Specified by:
        initialize in interface org.apache.uima.analysis_component.AnalysisComponent
        Overrides:
        initialize in class org.apache.uima.analysis_component.AnalysisComponent_ImplBase
        Throws:
        org.apache.uima.resource.ResourceInitializationException
      • process

        public void process​(org.apache.uima.jcas.JCas aJCas)
                     throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
        process current CAS. In case, abbreviation expansion is turned on, the abbreviation is replaced by its full form which is used during prediction. The labels of this full form are then applied to the original, short form.
        Specified by:
        process in class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • createUnitSentence

        protected Sentence createUnitSentence​(ArrayList<de.julielab.jcore.types.Token> tokenList,
                                              org.apache.uima.jcas.JCas JCas)
        Takes all info about meta data and generates the corresponding unit sequence represented by a Sentence object. Abbreviation is expanded when specified in descriptor. Only abbreviations which span over single tokens can be interpreted here. Other case (which is very rare and thus probably not relevant) is ignored!
        Parameters:
        tokenList - a list of Token objects of the current sentence
        JCas - the CAS we are working on
        metaList - a Arraylist of meta-info HashMaps which specify the meta information of the respective token
        Returns:
        an array of two sequences of units containing all available meta data for the corresponding tokens. In the first sequence, abbreviations are expanded to their fullform. In the second sequence, the tokens are of their original form.
      • writeToCAS

        public void writeToCAS​(Sentence unitSentence,
                               org.apache.uima.jcas.JCas aJCas,
                               ArrayList<de.julielab.jcore.types.Token> tokenList)
                        throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
        creates the respective uima annotations from JPOS's predictions. Therefore, we loop over JPOS's Sentence objects which contain predictions/labels for each Unit (i.e., for each token).
        Parameters:
        unitSentence - the current Sentence object
        aJCas - the cas to write the annotation to
        tokenList -
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException