org.apache.ctakes.relationextractor.ae
Class RelationExtractorAnnotator
java.lang.Object
org.apache.uima.analysis_component.AnalysisComponent_ImplBase
org.apache.uima.analysis_component.Annotator_ImplBase
org.apache.uima.analysis_component.JCasAnnotator_ImplBase
org.uimafit.component.JCasAnnotator_ImplBase
org.cleartk.classifier.CleartkAnnotator<String>
org.apache.ctakes.relationextractor.ae.RelationExtractorAnnotator
- All Implemented Interfaces:
- org.apache.uima.analysis_component.AnalysisComponent, org.uimafit.factory.initializable.Initializable
- Direct Known Subclasses:
- Baseline1EntityMentionPairRelationExtractorAnnotator, Baseline2DegreeOfRelationExtractorAnnotator, Baseline2EntityMentionPairRelationExtractorAnnotator, Baseline3DegreeOfRelationExtractorAnnotator, Baseline3EntityMentionPairRelationExtractorAnnotator, Baseline4EntityMentionPairRelationExtractorAnnotator, DegreeOfRelationExtractorAnnotator, LocationOfRelationExtractorAnnotator
public abstract class RelationExtractorAnnotator
- extends org.cleartk.classifier.CleartkAnnotator<String>
Fields inherited from class org.cleartk.classifier.CleartkAnnotator |
classifier, dataWriter, PARAM_CLASSIFIER_FACTORY_CLASS_NAME, PARAM_DATA_WRITER_FACTORY_CLASS_NAME, PARAM_IS_TRAINING |
Methods inherited from class org.cleartk.classifier.CleartkAnnotator |
collectionProcessComplete, isTraining |
Methods inherited from class org.uimafit.component.JCasAnnotator_ImplBase |
getLogger |
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, destroy, getContext, getResultSpecification, reconfigure, setResultSpecification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NO_RELATION_CATEGORY
public static final String NO_RELATION_CATEGORY
- See Also:
- Constant Field Values
PARAM_PROBABILITY_OF_KEEPING_A_NEGATIVE_EXAMPLE
public static final String PARAM_PROBABILITY_OF_KEEPING_A_NEGATIVE_EXAMPLE
- See Also:
- Constant Field Values
probabilityOfKeepingANegativeExample
protected double probabilityOfKeepingANegativeExample
coin
protected Random coin
RelationExtractorAnnotator
public RelationExtractorAnnotator()
getFeatureExtractors
protected List<RelationFeaturesExtractor> getFeatureExtractors()
- Defines the list of feature extractors used by the classifier. Subclasses
may override this method to provide a different set of feature extractors.
- Returns:
- The list of feature extractors to use.
getRelationClass
protected Class<? extends BinaryTextRelation> getRelationClass()
getCoveringClass
protected abstract Class<? extends org.apache.uima.jcas.tcas.Annotation> getCoveringClass()
getCandidateRelationArgumentPairs
protected abstract List<RelationExtractorAnnotator.IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(org.apache.uima.jcas.JCas identifiedAnnotationView,
org.apache.uima.jcas.tcas.Annotation coveringAnnotation)
- Selects the relevant mentions/annotations within a covering annotation for
relation identification/extraction.
initialize
public void initialize(org.apache.uima.UimaContext context)
throws org.apache.uima.resource.ResourceInitializationException
- Specified by:
initialize
in interface org.apache.uima.analysis_component.AnalysisComponent
- Specified by:
initialize
in interface org.uimafit.factory.initializable.Initializable
- Overrides:
initialize
in class org.cleartk.classifier.CleartkAnnotator<String>
- 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
getRelationCategory
protected String getRelationCategory(Map<List<org.apache.uima.jcas.tcas.Annotation>,BinaryTextRelation> relationLookup,
IdentifiedAnnotation arg1,
IdentifiedAnnotation arg2)
- Looks up the arguments in the specified lookup table and converts the
relation into a label for classification
- Returns:
- If this category should not be processed for training return
null otherwise it returns the label sent to the datawriter
classify
protected String classify(List<org.cleartk.classifier.Feature> features)
throws org.cleartk.classifier.CleartkProcessingException
- Predict an outcome given a set of features. By default, this simply
delegates to the object's
classifier
. Subclasses may override
this method to implement more complex classification procedures.
- Parameters:
features
- The features to be classified.
- Returns:
- The predicted outcome (label) for the features.
- Throws:
org.cleartk.classifier.CleartkProcessingException
createRelation
protected void createRelation(org.apache.uima.jcas.JCas jCas,
IdentifiedAnnotation arg1,
IdentifiedAnnotation arg2,
String predictedCategory)
- Create a UIMA relation type based on arguments and the relation label. This
allows subclasses to create/define their own types: e.g. coreference can
create CoreferenceRelation instead of BinaryTextRelation
- Parameters:
jCas
- - JCas object, needed to create new UIMA typesarg1
- - First argument to relationarg2
- - Second argument to relationpredictedCategory
- - Name of relation
Copyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.