ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1583775 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: ae/feature/duration/ data/analysis/ duration/
Date Tue, 01 Apr 2014 20:15:59 GMT
Author: dligach
Date: Tue Apr  1 20:15:59 2014
New Revision: 1583775

URL: http://svn.apache.org/r1583775
Log:
refactoring related to new timex normalizer wrapper in Utils.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationTimeUnitFeatureExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/ExtractDurationsUsingContainsRelation.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintNormalizedTemporalExpressions.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventDurationDistribution.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/PreserveCertainEventTimeRelationsInGold.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationEventTimeFeatureExtractor.java
Tue Apr  1 20:15:59 2014
@@ -63,7 +63,7 @@ public class DurationEventTimeFeatureExt
     Map<String, Float> eventDistribution = textToDistribution.get(eventText);
     float eventExpectedDuration = Utils.expectedDuration(eventDistribution);
 
-    Set<TemporalUnit> units = Utils.normalize(timeText);
+    Set<TemporalUnit> units = Utils.runTimexParser(timeText);
     scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
     while(iterator.hasNext()) {
       TemporalUnit unit = iterator.next();

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationTimeUnitFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationTimeUnitFeatureExtractor.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationTimeUnitFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/duration/DurationTimeUnitFeatureExtractor.java
Tue Apr  1 20:15:59 2014
@@ -44,7 +44,7 @@ public class DurationTimeUnitFeatureExtr
     List<Feature> features = new ArrayList<Feature>();
     String timeText = arg2.getCoveredText().toLowerCase();  // arg2 is a time mention
 
-    Set<TemporalUnit> units = Utils.normalize(timeText);
+    Set<TemporalUnit> units = Utils.runTimexParser(timeText);
     if(units == null) {
       features.add(new Feature("failed_normalization", true));
       return features;
@@ -53,7 +53,7 @@ public class DurationTimeUnitFeatureExtr
     scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
     while(iterator.hasNext()) {
       TemporalUnit unit = iterator.next();
-      String coarseTimeUnit = Utils.makeCoarse(unit.getName());
+      String coarseTimeUnit = Utils.putInBin(unit.getName());
       
       if(coarseTimeUnit == null) {
         features.add(new Feature("failed_normalization", true));

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/ExtractDurationsUsingContainsRelation.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/ExtractDurationsUsingContainsRelation.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/ExtractDurationsUsingContainsRelation.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/ExtractDurationsUsingContainsRelation.java
Tue Apr  1 20:15:59 2014
@@ -159,7 +159,7 @@ public class ExtractDurationsUsingContai
         // occasionally event text has a leading eol character
         eventText = eventText.startsWith("\n") ? eventText.substring(1) : eventText; 
         
-        Set<TemporalUnit> units = Utils.normalize(timeText);
+        Set<TemporalUnit> units = Utils.runTimexParser(timeText);
         if(units == null) {
           continue;
         }
@@ -167,7 +167,7 @@ public class ExtractDurationsUsingContai
         scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
         while(iterator.hasNext()) {
           TemporalUnit unit = iterator.next();
-          String coarseUnit = Utils.makeCoarse(unit.getName());
+          String coarseUnit = Utils.putInBin(unit.getName());
           if(coarseUnit != null) {
             if(eventTimeUnitCount.containsKey(eventText)) {
               eventTimeUnitCount.get(eventText).add(coarseUnit);

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintNormalizedTemporalExpressions.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintNormalizedTemporalExpressions.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintNormalizedTemporalExpressions.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintNormalizedTemporalExpressions.java
Tue Apr  1 20:15:59 2014
@@ -33,7 +33,7 @@ public class PrintNormalizedTemporalExpr
     
     for(TimeMention mention : Lists.newArrayList(JCasUtil.select(goldView, TimeMention.class)))
{
       String timex = mention.getCoveredText().toLowerCase();
-      Set<TemporalUnit> units = Utils.normalize(timex);
+      Set<TemporalUnit> units = Utils.runTimexParser(timex);
 
       if(units == null) {
         System.out.println(timex + "|" + "n/a");

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventDurationDistribution.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventDurationDistribution.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventDurationDistribution.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/EventDurationDistribution.java
Tue Apr  1 20:15:59 2014
@@ -15,7 +15,7 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.typesystem.type.structured.DocumentID;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
-import org.apache.ctakes.typesystem.type.textsem.SignSymptomMention;
+import org.apache.ctakes.typesystem.type.textsem.MedicationMention;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -42,7 +42,7 @@ import com.google.common.collect.Multise
  */
 public class EventDurationDistribution {
 
-  private static Class<? extends EventMention> targetClass = SignSymptomMention.class;
+  private static Class<? extends EventMention> targetClass = MedicationMention.class;
   
   public static class Options  {
 
@@ -121,10 +121,12 @@ public class EventDurationDistribution {
           if(isNegated(jCas, mention) || isMedicationPattern(jCas, mention)) {
             continue;
           }
-          
+
           TimeMention nearestTimeMention = getNearestTimeMention(jCas, mention);
           if(nearestTimeMention != null) {
             Matcher matcher = pattern.matcher(nearestTimeMention.getCoveredText());
+            
+            System.out.println(nearestTimeMention.getCoveredText());
 
             // need the loop to handle things like 'several days/weeks'
             while(matcher.find()) {
@@ -137,9 +139,9 @@ public class EventDurationDistribution {
       }
 
       if(durationDistribution.size() > 0) { 
-        System.out.println(Utils.formatDistribution(mentionText, durationDistribution, ",
", true) + "[" + durationDistribution.size() + " instances]");
+//        System.out.println(Utils.formatDistribution(mentionText, durationDistribution,
", ", true) + "[" + durationDistribution.size() + " instances]");
       }else{
-        System.out.println(mentionText + ": No duration information found.");
+//        System.out.println(mentionText + ": No duration information found.");
       }
     }
     

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/PreserveCertainEventTimeRelationsInGold.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/PreserveCertainEventTimeRelationsInGold.java?rev=1583775&r1=1583774&r2=1583775&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/PreserveCertainEventTimeRelationsInGold.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/PreserveCertainEventTimeRelationsInGold.java
Tue Apr  1 20:15:59 2014
@@ -67,7 +67,7 @@ public class PreserveCertainEventTimeRel
         continue;
       }    
 
-      Set<TemporalUnit> units = Utils.normalize(timeText);
+      Set<TemporalUnit> units = Utils.runTimexParser(timeText);
       if(textToDistribution.containsKey(eventText) && units != null) {
         // there is duration information and we are able to get time units, so keep this
         continue;
@@ -90,7 +90,7 @@ public class PreserveCertainEventTimeRel
     // finally remove time expressions (that didn't participate in relations) that have no
data
     for(TimeMention mention : Lists.newArrayList(JCasUtil.select(goldView, TimeMention.class)))
{
       String timeText = mention.getCoveredText().toLowerCase();
-      Set<TemporalUnit> units = Utils.normalize(timeText);
+      Set<TemporalUnit> units = Utils.runTimexParser(timeText);
       if(units != null) {
         // these are the kind we keep
         continue;



Mime
View raw message