ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1481793 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
Date Mon, 13 May 2013 11:30:53 GMT
Author: tmill
Date: Mon May 13 11:30:52 2013
New Revision: 1481793

URL: http://svn.apache.org/r1481793
Log:
Added new feature I missed with last commit.

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

Added: 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=1481793&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
(added)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EventArgumentPropertyExtractor.java
Mon May 13 11:30:52 2013
@@ -0,0 +1,45 @@
+package org.apache.ctakes.temporal.ae.feature;
+
+import java.util.ArrayList;
+import java.util.Collection;
+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.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.cleartk.classifier.Feature;
+
+public class EventArgumentPropertyExtractor implements
+    RelationFeaturesExtractor {
+
+  @Override
+  public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1,
+      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
+    List<Feature> feats = new ArrayList<Feature>();
+    
+    if(arg1 instanceof EventMention){
+      feats.addAll(getEventFeats("mention1property", (EventMention)arg1));
+    }
+    if(arg2 instanceof EventMention){
+      feats.addAll(getEventFeats("mention2property", (EventMention)arg2));
+    }
+    return feats;
+   }
+
+  private static Collection<? extends Feature> getEventFeats(String name, EventMention
mention) {
+    List<Feature> feats = new ArrayList<Feature>();
+    
+    feats.add(new Feature(name + "_modality", mention.getEvent().getProperties().getContextualModality()));
+    feats.add(new Feature(name + "_aspect", mention.getEvent().getProperties().getContextualAspect()));
+    feats.add(new Feature(name + "_permanence", mention.getEvent().getProperties().getPermanence()));
+    feats.add(new Feature(name + "_polarity", mention.getEvent().getProperties().getPolarity()));
+    feats.add(new Feature(name + "_category", mention.getEvent().getProperties().getCategory()));
+    feats.add(new Feature(name + "_degree", mention.getEvent().getProperties().getDegree()));
+    feats.add(new Feature(name + "_doctimerel", mention.getEvent().getProperties().getDocTimeRel()));
+    
+    return feats;
+  }
+
+}



Mime
View raw message