edu.ucdenver.ccp.nlp.biolemmatizer.uima
Class DefaultLemmaDecorator

java.lang.Object
  extended by edu.ucdenver.ccp.nlp.biolemmatizer.uima.DefaultLemmaDecorator
All Implemented Interfaces:
edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma>, edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.LemmaDecorator

public class DefaultLemmaDecorator
extends Object
implements edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.LemmaDecorator

This simple implementation of the LemmaDecorator interface adds a new LemmaAnnotation to the CAS for each token annotation processed.

Author:
Colorado Computational Pharmacology, UC Denver; ccpsupport@ucdenver.edu

Constructor Summary
DefaultLemmaDecorator()
           
 
Method Summary
 void decorateAnnotation(Annotation annotation, String attributeType, edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma lemma)
           
 List<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma> extractAttribute(Annotation annotation, String attributeType)
           
 List<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma> extractLemmas(Annotation annotation)
           
 Annotation getAnnotationToDecorate(Annotation tokenAnnotation, edu.ucdenver.ccp.uima.shims.annotation.AnnotationDataExtractor annotationDataExtractor)
          In the case of the DefaultLemmaDecorator, the annotation to decorate is a LemmaAnnotation with the same span as the token that was used to process the lemma.
 void insertLemma(Annotation annotation, edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma lemma)
          Inserts information representing the input Lemma into the input Annotation which is assumed to be of type LemmaAnnotation in this instance.
 Annotation newAnnotation(JCas jcas, String type, edu.ucdenver.ccp.uima.shims.annotation.Span span)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLemmaDecorator

public DefaultLemmaDecorator()
Method Detail

newAnnotation

public Annotation newAnnotation(JCas jcas,
                                String type,
                                edu.ucdenver.ccp.uima.shims.annotation.Span span)
Specified by:
newAnnotation in interface edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma>
Returns:
an initialized LemmaAnnotation
See Also:
AnnotationDecorator.newAnnotation(org.apache.uima.jcas.JCas, java.lang.String, edu.ucdenver.ccp.uima.shims.annotation.Span)

getAnnotationToDecorate

public Annotation getAnnotationToDecorate(Annotation tokenAnnotation,
                                          edu.ucdenver.ccp.uima.shims.annotation.AnnotationDataExtractor annotationDataExtractor)
In the case of the DefaultLemmaDecorator, the annotation to decorate is a LemmaAnnotation with the same span as the token that was used to process the lemma. This method looks to see if that LemmaAnnotation exists. If it does it is returned. If it does not exist, then a new LemmaAnnotation is created and then returned.

Specified by:
getAnnotationToDecorate in interface edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma>
Parameters:
tokenAnnotation - in this case, the input annotation represents the token annotation whose covered text was lemmatized
See Also:
AnnotationDecorator.getAnnotationToDecorate(org.apache.uima.jcas.tcas.Annotation, edu.ucdenver.ccp.uima.shims.annotation.AnnotationDataExtractor)

decorateAnnotation

public void decorateAnnotation(Annotation annotation,
                               String attributeType,
                               edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma lemma)
Specified by:
decorateAnnotation in interface edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma>
See Also:
edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator#decorateAnnotation(org.apache .uima.jcas.tcas.Annotation, java.lang.String, java.lang.Object)

insertLemma

public void insertLemma(Annotation annotation,
                        edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma lemma)
Inserts information representing the input Lemma into the input Annotation which is assumed to be of type LemmaAnnotation in this instance.

Specified by:
insertLemma in interface edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.LemmaDecorator
Throws:
IllegalArgumentException - if the input Annotation is not a LemmaAnnotation
See Also:
LemmaDecorator.insertLemma(org.apache.uima.jcas.tcas.Annotation, edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma)

extractAttribute

public List<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma> extractAttribute(Annotation annotation,
                                                                                           String attributeType)
Specified by:
extractAttribute in interface edu.ucdenver.ccp.uima.shims.annotation.AnnotationDecorator<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma>

extractLemmas

public List<edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.Lemma> extractLemmas(Annotation annotation)
Specified by:
extractLemmas in interface edu.ucdenver.ccp.uima.shims.annotation.syntactic.token.LemmaDecorator


Copyright © 2013. All Rights Reserved.