ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1466599 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae: DocTimeRelAnnotator.java feature/ClosestVerbExtractor.java feature/EvevtPropertyExtractor.java
Date Wed, 10 Apr 2013 18:01:11 GMT
Author: clin
Date: Wed Apr 10 18:01:11 2013
New Revision: 1466599

URL: http://svn.apache.org/r1466599
Log:
add a feature extractor for docTimerel: contextual Modality type: GENERIC
add the closest verb token as a feature for docTimeRel

Added:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java
  (with props)
Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/ClosestVerbExtractor.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java?rev=1466599&r1=1466598&r2=1466599&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotator.java
Wed Apr 10 18:01:11 2013
@@ -22,6 +22,7 @@ import java.io.File;
 import java.util.List;
 
 import org.apache.ctakes.temporal.ae.feature.ClosestVerbExtractor;
+import org.apache.ctakes.temporal.ae.feature.EvevtPropertyExtractor;
 import org.apache.ctakes.temporal.ae.feature.NearbyVerbTenseXExtractor;
 import org.apache.ctakes.temporal.ae.feature.SectionHeaderExtractor;
 import org.apache.ctakes.temporal.ae.feature.TimeXExtractor;
@@ -79,6 +80,7 @@ public class DocTimeRelAnnotator extends
   private SectionHeaderExtractor sectionIDExtractor;
   private ClosestVerbExtractor closestVerbExtractor;
   private TimeXExtractor timeXExtractor;
+  private EvevtPropertyExtractor genericExtractor;
 
   @Override
   public void initialize(UimaContext context) throws ResourceInitializationException {
@@ -96,6 +98,7 @@ public class DocTimeRelAnnotator extends
     this.sectionIDExtractor = new SectionHeaderExtractor();
     this.closestVerbExtractor = new ClosestVerbExtractor();
     this.timeXExtractor = new TimeXExtractor();
+    this.genericExtractor = new EvevtPropertyExtractor();
   }
 
   @Override
@@ -107,6 +110,7 @@ public class DocTimeRelAnnotator extends
         features.addAll(this.sectionIDExtractor.extract(jCas, eventMention)); //add section
heading
         features.addAll(this.closestVerbExtractor.extract(jCas, eventMention)); //add closest
verb
         features.addAll(this.timeXExtractor.extract(jCas, eventMention)); //add the closest
time expression types
+        features.addAll(this.genericExtractor.extract(jCas, eventMention)); //add the closest
time expression types
         if (this.isTraining()) {
           String outcome = eventMention.getEvent().getProperties().getDocTimeRel();
           this.dataWriter.write(new Instance<String>(outcome, features));

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/ClosestVerbExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/ClosestVerbExtractor.java?rev=1466599&r1=1466598&r2=1466599&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/ClosestVerbExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/ClosestVerbExtractor.java
Wed Apr 10 18:01:11 2013
@@ -72,8 +72,8 @@ public class ClosestVerbExtractor implem
 				  }
 			  }
 			  for (Map.Entry<Integer, WordToken> entry : verbDistMap.entrySet()) {
-				  //Feature feature = new Feature(this.name, entry.getValue().getCoveredText());
-				  //		        	  features.add(feature);
+				  Feature feature = new Feature(this.name+"_token", entry.getValue().getCoveredText());
+				  		        	  features.add(feature);
 				  //logger.info("found nearby closest verb: "+ entry.getValue().getCoveredText() + "
POS:" + entry.getValue().getPartOfSpeech());
 				  Feature posfeature = new Feature(this.name, entry.getValue().getPartOfSpeech());
 				  features.add(posfeature);

Added: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java?rev=1466599&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java
(added)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java
Wed Apr 10 18:01:11 2013
@@ -0,0 +1,59 @@
+/**
+ * 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 java.util.logging.Logger;
+
+import org.apache.ctakes.typesystem.type.textsem.EventMention;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.cleartk.classifier.Feature;
+import org.cleartk.classifier.feature.extractor.CleartkExtractorException;
+import org.cleartk.classifier.feature.extractor.simple.SimpleFeatureExtractor;
+
+public class EvevtPropertyExtractor implements SimpleFeatureExtractor {
+
+  private String name;
+
+//  private Logger logger = Logger.getLogger(this.getClass().getName());
+
+  public EvevtPropertyExtractor() {
+    super();
+    this.name = "EventContextualModality";
+    
+  }
+
+  @Override
+  public List<Feature> extract(JCas view, Annotation annotation) throws CleartkExtractorException
{
+	  List<Feature> features = new ArrayList<Feature>();
+	  
+	  //1 get event:
+	  EventMention event = (EventMention)annotation;
+	  String contextModal = event.getEvent().getProperties().getContextualModality();
+	  if (contextModal.equals("GENERIC")){
+		  Feature contexmod = new Feature(this.name, contextModal);
+		  features.add(contexmod);
+//		  logger.info("found a event: "+ contextModal);
+	  }
+	  return features;
+  }
+
+}

Propchange: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/EvevtPropertyExtractor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message