ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1452317 - in /incubator/ctakes/trunk: ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/ ctakes-temporal/src/main/java/o...
Date Mon, 04 Mar 2013 14:12:35 GMT
Author: tmill
Date: Mon Mar  4 14:12:34 2013
New Revision: 1452317

URL: http://svn.apache.org/r1452317
Log:
ctakes-173: Generalizes relation extractor to relations over any Annotation type.  Fixes implementing
classes in relation project and in temporal project.

Modified:
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DegreeOfRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/EntityMentionPairRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1DegreeOfRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1EntityMentionPairRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2DegreeOfRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2EntityMentionPairRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3DegreeOfRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3EntityMentionPairRelationExtractorAnnotator.java
    incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DegreeOfRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DegreeOfRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DegreeOfRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DegreeOfRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -25,6 +25,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textsem.Modifier;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.uimafit.util.JCasUtil;
 
 /**
@@ -35,7 +36,7 @@ public class DegreeOfRelationExtractorAn
 
 	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 		
 		List<EntityMention> entities = JCasUtil.selectCovered(identifiedAnnotationView, EntityMention.class,
sentence);
 		List<Modifier> modifiers = JCasUtil.selectCovered(identifiedAnnotationView, Modifier.class,
sentence);
@@ -48,4 +49,10 @@ public class DegreeOfRelationExtractorAn
 		}
 		return pairs;
 	}
+
+	@Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		// TODO Auto-generated method stub
+		return Sentence.class;
+	}
 }

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/EntityMentionPairRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/EntityMentionPairRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/EntityMentionPairRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/EntityMentionPairRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -50,8 +50,13 @@ public class EntityMentionPairRelationEx
 	protected boolean classifyBothDirections = false;
 
 	@Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		return Sentence.class;
+	}
+	
+	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 
 		// collect all possible relation arguments from the sentence
 		List<EntityMention> args = JCasUtil.selectCovered(

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/RelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -35,7 +35,6 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.relation.RelationArgument;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
-import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.tcas.Annotation;
@@ -64,6 +63,8 @@ public abstract class RelationExtractorA
 
   private List<RelationFeaturesExtractor> featureExtractors = this.getFeatureExtractors();
   
+  private Class<? extends Annotation> coveringClass = getCoveringClass();
+
   /**
    * Defines the list of feature extractors used by the classifier.
    * Subclasses may override this method to provide a different set of feature extractors.

@@ -81,10 +82,15 @@ public abstract class RelationExtractorA
         );
   }
  
+  /*
+   * Defines the type of annotation that the relation exists within (sentence, document,
segment) 
+   */
+  protected abstract Class<? extends Annotation> getCoveringClass();
+  
   /**
-   * Selects the relevant mentions/annotations within a sentence for relation identification/extraction.
+   * Selects the relevant mentions/annotations within a covering annotation for relation
identification/extraction.
    */
-  protected abstract List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(JCas
identifiedAnnotationView, Sentence sentence);
+  protected abstract List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(JCas
identifiedAnnotationView, Annotation coveringAnnotation);
 
   /*
    * Implement the standard UIMA process method.
@@ -107,10 +113,10 @@ public abstract class RelationExtractorA
     }
 
     // walk through each sentence in the text
-    for (Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
+    for (Annotation coveringAnnotation : JCasUtil.select(jCas, coveringClass)) {
 
     	// collect all relevant relation arguments from the sentence
-    	List<IdentifiedAnnotationPair> candidatePairs = this.getCandidateRelationArgumentPairs(jCas,
sentence);
+    	List<IdentifiedAnnotationPair> candidatePairs = this.getCandidateRelationArgumentPairs(jCas,
coveringAnnotation);
 
     	// walk through the pairs of annotations
     	for (IdentifiedAnnotationPair pair : candidatePairs) {
@@ -154,20 +160,7 @@ public abstract class RelationExtractorA
     					arg2 = temp;
     				}
 
-    				// add the relation to the CAS
-    				RelationArgument relArg1 = new RelationArgument(jCas);
-    				relArg1.setArgument(arg1);
-    				relArg1.setRole("Argument");
-    				relArg1.addToIndexes();
-    				RelationArgument relArg2 = new RelationArgument(jCas);
-    				relArg2.setArgument(arg2);
-    				relArg2.setRole("Related_to");
-    				relArg2.addToIndexes();
-    				BinaryTextRelation relation = new BinaryTextRelation(jCas);
-    				relation.setArg1(relArg1);
-    				relation.setArg2(relArg2);
-    				relation.setCategory(predictedCategory);
-    				relation.addToIndexes();
+    				createRelation(jCas, arg1, arg2, predictedCategory);
     			}
     		}
     	} // end pair in pairs
@@ -208,6 +201,31 @@ public abstract class RelationExtractorA
     return this.classifier.classify(features);
   }
 
+  /**
+   * 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
+   * @param jCas - JCas object, needed to create new UIMA types
+   * @param arg1 - First argument to relation
+   * @param arg2 - Second argument to relation
+   * @param predictedCategory - Name of relation
+   */
+  protected void createRelation(JCas jCas, IdentifiedAnnotation arg1, IdentifiedAnnotation
arg2, String predictedCategory){
+		// add the relation to the CAS
+		RelationArgument relArg1 = new RelationArgument(jCas);
+		relArg1.setArgument(arg1);
+		relArg1.setRole("Argument");
+		relArg1.addToIndexes();
+		RelationArgument relArg2 = new RelationArgument(jCas);
+		relArg2.setArgument(arg2);
+		relArg2.setRole("Related_to");
+		relArg2.addToIndexes();
+		BinaryTextRelation relation = new BinaryTextRelation(jCas);
+		relation.setArg1(relArg1);
+		relation.setArg2(relArg2);
+		relation.setCategory(predictedCategory);
+		relation.addToIndexes();
+  }
   
   public static class IdentifiedAnnotationPair {
 	  

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1DegreeOfRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1DegreeOfRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1DegreeOfRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1DegreeOfRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -22,8 +22,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.ctakes.relationextractor.ae.DegreeOfRelationExtractorAnnotator;
-import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.CleartkProcessingException;
 import org.cleartk.classifier.Feature;
 
@@ -35,7 +35,7 @@ public class Baseline1DegreeOfRelationEx
 
 	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 	  List<IdentifiedAnnotationPair> pairs = super.getCandidateRelationArgumentPairs(identifiedAnnotationView,
sentence);
 		
 		// look for sentences with one entity and one modifier

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1EntityMentionPairRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1EntityMentionPairRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1EntityMentionPairRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline1EntityMentionPairRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -25,6 +25,7 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.typesystem.type.textsem.EntityMention;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.Feature;
 import org.uimafit.util.JCasUtil;
 
@@ -37,8 +38,13 @@ import com.google.common.collect.Lists;
 public class Baseline1EntityMentionPairRelationExtractorAnnotator extends RelationExtractorAnnotator
{
 	
 	@Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		return Sentence.class;
+	}
+	
+	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 
 		// collect all possible relation arguments from the sentence
 		List<EntityMention> args = JCasUtil.selectCovered(

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2DegreeOfRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2DegreeOfRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2DegreeOfRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2DegreeOfRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -30,6 +30,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.CleartkProcessingException;
 import org.cleartk.classifier.Feature;
 import org.uimafit.util.JCasUtil;
@@ -47,8 +48,13 @@ import com.google.common.collect.Orderin
 public class Baseline2DegreeOfRelationExtractorAnnotator extends RelationExtractorAnnotator
{
 
 	@Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		return Sentence.class;
+	}
+	
+	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 		
 		List<EntityMention> entities = JCasUtil.selectCovered(identifiedAnnotationView, EntityMention.class,
sentence);
 		List<Modifier> modifiers = JCasUtil.selectCovered(identifiedAnnotationView, Modifier.class,
sentence);

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2EntityMentionPairRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2EntityMentionPairRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2EntityMentionPairRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline2EntityMentionPairRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -31,6 +31,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.Feature;
 import org.uimafit.util.JCasUtil;
 
@@ -45,8 +46,13 @@ import com.google.common.collect.Orderin
 public class Baseline2EntityMentionPairRelationExtractorAnnotator extends RelationExtractorAnnotator
{
 	
 	@Override
+	public Class<? extends Annotation> getCoveringClass(){
+		return Sentence.class;
+	}
+	
+	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 
 		// collect all possible relation arguments from the sentence
 		List<EntityMention> args = JCasUtil.selectCovered(

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3DegreeOfRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3DegreeOfRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3DegreeOfRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3DegreeOfRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -26,6 +26,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 
 /**
  * Annotate degree_of relation between two entities whenever 
@@ -35,14 +36,14 @@ public class Baseline3DegreeOfRelationEx
 
 	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 		List<IdentifiedAnnotationPair> pairs = super.getCandidateRelationArgumentPairs(identifiedAnnotationView,
sentence);
 		
     // find pairs enclosed inside a noun phrase
     List<IdentifiedAnnotationPair> result = new ArrayList<IdentifiedAnnotationPair>();
     for(IdentifiedAnnotationPair pair : pairs) {
       if(Utils.validateDegreeOfArgumentTypes(pair)) {
-        for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, sentence))
{
+        for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, (Sentence)
sentence)) {
           if(Utils.isEnclosed(pair, nounPhrase)) {
             IdentifiedAnnotation arg1 = pair.getArg1();
             IdentifiedAnnotation arg2 = pair.getArg2();

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3EntityMentionPairRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3EntityMentionPairRelationExtractorAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3EntityMentionPairRelationExtractorAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/baselines/Baseline3EntityMentionPairRelationExtractorAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -27,6 +27,7 @@ import org.apache.ctakes.typesystem.type
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.cleartk.classifier.Feature;
 import org.uimafit.util.JCasUtil;
 
@@ -37,8 +38,13 @@ import org.uimafit.util.JCasUtil;
 public class Baseline3EntityMentionPairRelationExtractorAnnotator extends RelationExtractorAnnotator
{
 	
 	@Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		return Sentence.class;
+	}
+
+	@Override
 	public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
-			JCas identifiedAnnotationView, Sentence sentence) {
+			JCas identifiedAnnotationView, Annotation sentence) {
 
 		// collect all possible relation arguments from the sentence
 		List<EntityMention> args = JCasUtil.selectCovered(
@@ -61,7 +67,7 @@ public class Baseline3EntityMentionPairR
 		List<IdentifiedAnnotationPair> result = new ArrayList<IdentifiedAnnotationPair>();
 		for(IdentifiedAnnotationPair pair : pairs) {
 		  if(Utils.validateLocationOfArgumentTypes(pair)) {
-		    for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, sentence))
{
+		    for(TreebankNode nounPhrase : Utils.getNounPhrases(identifiedAnnotationView, (Sentence)
sentence)) {
 		      if(Utils.isEnclosed(pair, nounPhrase)) {
 		        IdentifiedAnnotation arg1 = pair.getArg1();
 		        IdentifiedAnnotation arg2 = pair.getArg2();

Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java?rev=1452317&r1=1452316&r2=1452317&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
(original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
Mon Mar  4 14:12:34 2013
@@ -63,9 +63,14 @@ public class EventTimeRelationAnnotator 
   }
 
   @Override
+	protected Class<? extends Annotation> getCoveringClass() {
+		return Sentence.class;
+	}
+  
+  @Override
   public List<IdentifiedAnnotationPair> getCandidateRelationArgumentPairs(
       JCas jCas,
-      Sentence sentence) {
+      Annotation sentence) {
     List<IdentifiedAnnotationPair> pairs = Lists.newArrayList();
     for (EventMention event : JCasUtil.selectCovered(jCas, EventMention.class, sentence))
{
       // ignore subclasses like Procedure and Disease/Disorder



Mime
View raw message