ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1490038 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
Date Wed, 05 Jun 2013 21:35:58 GMT
Author: tmill
Date: Wed Jun  5 21:35:57 2013
New Revision: 1490038

URL: http://svn.apache.org/r1490038
Log:
Completed method for event argument extraction.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java?rev=1490038&r1=1490037&r2=1490038&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
Wed Jun  5 21:35:57 2013
@@ -7,9 +7,11 @@ import java.util.List;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 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.cleartk.classifier.Feature;
+import org.uimafit.util.JCasUtil;
 
 public class EventArgumentPropertyExtractor implements
     RelationFeaturesExtractor {
@@ -19,6 +21,24 @@ public class EventArgumentPropertyExtrac
       IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
     List<Feature> feats = new ArrayList<Feature>();
     
+    Sentence coveringSent = JCasUtil.selectCovering(jCas, Sentence.class, arg1.getBegin(),
arg1.getEnd()).get(0);
+    List<EventMention> events = JCasUtil.selectCovered(EventMention.class, coveringSent);
+    List<EventMention> realEvents = new ArrayList<EventMention>();
+    for(EventMention event : events){
+    	// filter out ctakes events
+    	if(event.getClass().equals(EventMention.class)){
+    		realEvents.add(event);
+    	}
+    }
+    events = realEvents;
+    EventMention anchor = events.get(0);
+    
+    if(arg1.getBegin() == anchor.getBegin() && arg1.getEnd() == anchor.getEnd()){
+    	feats.add(new Feature("Arg1LeftmostEvent"));
+    }else if(arg2.getBegin() == anchor.getBegin() && arg2.getEnd() == anchor.getEnd()){
+    	feats.add(new Feature("Arg2LeftmostEvent"));
+    }
+    
     if(arg1 instanceof EventMention){
       feats.addAll(getEventFeats("mention1property", (EventMention)arg1));
     }



Mime
View raw message