ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1477808 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae: EventTimeRelationAnnotator.java feature/DocTimeRelFeatureExtractor.java
Date Tue, 30 Apr 2013 20:15:53 GMT
Author: dligach
Date: Tue Apr 30 20:15:53 2013
New Revision: 1477808

URL: http://svn.apache.org/r1477808
Log:
added feature based on event's doc time rel

Added:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/DocTimeRelFeatureExtractor.java
Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java?rev=1477808&r1=1477807&r2=1477808&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
Tue Apr 30 20:15:53 2013
@@ -9,6 +9,7 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
+import org.apache.ctakes.temporal.ae.feature.DocTimeRelFeatureExtractor;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
@@ -59,7 +60,10 @@ public class EventTimeRelationAnnotator 
 
   @Override
   protected List<RelationFeaturesExtractor> getFeatureExtractors() {
-    return Lists.newArrayList(new TokenFeaturesExtractor(), new PartOfSpeechFeaturesExtractor());
+    return Lists.newArrayList(
+        new TokenFeaturesExtractor(), 
+        new PartOfSpeechFeaturesExtractor(), 
+        new DocTimeRelFeatureExtractor());
   }
 
   @Override

Added: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/DocTimeRelFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/DocTimeRelFeatureExtractor.java?rev=1477808&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/DocTimeRelFeatureExtractor.java
(added)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/DocTimeRelFeatureExtractor.java
Tue Apr 30 20:15:53 2013
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.temporal.ae.feature;
+
+import java.util.ArrayList;
+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 DocTimeRelFeatureExtractor implements RelationFeaturesExtractor {
+
+  @Override
+  public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1, IdentifiedAnnotation
arg2)
+      throws AnalysisEngineProcessException {
+
+    List<Feature> features = new ArrayList<Feature>();
+    
+    if(arg1 instanceof EventMention) {
+      EventMention event = (EventMention) arg1;
+      String docTimeRel = event.getEvent().getProperties().getDocTimeRel();
+      features.add(new Feature("arg1DocTimeRel", docTimeRel));
+    }
+    
+    if(arg2 instanceof EventMention) {
+      EventMention event = (EventMention) arg2;
+      String docTimeRel = event.getEvent().getProperties().getDocTimeRel();
+      features.add(new Feature("arg2DocTimeRel", docTimeRel));
+    }
+    
+    return features;
+  }
+}



Mime
View raw message