Class MedAttrAnnotator

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

    public class MedAttrAnnotator
    extends org.apache.uima.analysis_component.JCasAnnotator_ImplBase
    Author:
    Sunghwan Sohn Extract medication attributes defined in regExPatterns
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALLOW_MULT_ANNO  
      static java.lang.String REGEX_FILE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addToJCas2​(org.apache.uima.jcas.JCas jcas, java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> annot)  
      protected java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> getAttribute2​(java.lang.String text)
      Find and return medication attributes in text
      protected java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getRegEx​(java.io.InputStream input)
      Return regular expression patterns for med attributes
      void initialize​(org.apache.uima.UimaContext uimaContext)  
      void process​(org.apache.uima.jcas.JCas jcas)  
      protected java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> removeOverlap​(java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> attr)
      Remove duplicates or take a longer attribute if subsumed and return the updated list of Attribute
      • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MedAttrAnnotator

        public MedAttrAnnotator()
    • Method Detail

      • initialize

        public void initialize​(org.apache.uima.UimaContext uimaContext)
                        throws org.apache.uima.resource.ResourceInitializationException
        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 jcas)
                     throws org.apache.uima.analysis_engine.AnalysisEngineProcessException
        Specified by:
        process in class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
        Throws:
        org.apache.uima.analysis_engine.AnalysisEngineProcessException
      • addToJCas2

        protected void addToJCas2​(org.apache.uima.jcas.JCas jcas,
                                  java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> annot)
      • getAttribute2

        protected java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> getAttribute2​(java.lang.String text)
        Find and return medication attributes in text
        Parameters:
        text - String to extract attributes
        Returns:
        List of Attribute classes
      • removeOverlap

        protected java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> removeOverlap​(java.util.List<org.ohnlp.ae.medxn.MedAttrAnnotator.Attribute> attr)
        Remove duplicates or take a longer attribute if subsumed and return the updated list of Attribute
        Parameters:
        attr - List of Attribute class
        Returns:
        List of Attribute class without duplicates/overlaps
      • getRegEx

        protected java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getRegEx​(java.io.InputStream input)
        Return regular expression patterns for med attributes
        Parameters:
        input - file name of the regEx file
        Returns:
        Map of attribute regular expression (key:tag, val:List of regular expression patterns)