ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1731747 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: ae/feature/duration/ data/analysis/ duration/
Date Mon, 22 Feb 2016 22:00:21 GMT
Author: clin
Date: Mon Feb 22 22:00:21 2016
New Revision: 1731747

URL: http://svn.apache.org/viewvc?rev=1731747&view=rev
Log:
correct errors related to timenorm usage

Modified:
    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/PrintFailedTimeNormalizations.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/ExtractDurationsUsingContainsRelation.java

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=1731747&r1=1731746&r2=1731747&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
Mon Feb 22 22:00:21 2016
@@ -28,7 +28,8 @@ import org.apache.ctakes.typesystem.type
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.jcas.JCas;
 import org.cleartk.ml.Feature;
-import org.threeten.bp.temporal.TemporalUnit;
+//import org.threeten.bp.temporal.TemporalUnit;
+import java.time.temporal.TemporalUnit;
 
 import scala.collection.immutable.Set;
 
@@ -41,7 +42,7 @@ public class DurationTimeUnitFeatureExtr
   public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1, IdentifiedAnnotation
arg2)
       throws AnalysisEngineProcessException {
     
-    List<Feature> features = new ArrayList<Feature>();
+    List<Feature> features = new ArrayList<>();
     String timeText = arg2.getCoveredText().toLowerCase();  // arg2 is a time mention
 
     Set<TemporalUnit> units = Utils.runTimexParser(timeText);
@@ -53,7 +54,7 @@ public class DurationTimeUnitFeatureExtr
     scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
     while(iterator.hasNext()) {
       TemporalUnit unit = iterator.next();
-      String coarseTimeUnit = Utils.putInBin(unit.getName());
+      String coarseTimeUnit = Utils.putInBin(unit.toString());
       
       if(coarseTimeUnit == null) {
         features.add(new Feature("failed_normalization", true));

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java?rev=1731747&r1=1731746&r2=1731747&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/PrintFailedTimeNormalizations.java
Mon Feb 22 22:00:21 2016
@@ -18,6 +18,7 @@
  */
 package org.apache.ctakes.temporal.data.analysis;
 
+import info.bethard.timenorm.DefaultTokenizer$;
 import info.bethard.timenorm.Temporal;
 import info.bethard.timenorm.TemporalExpressionParser;
 import info.bethard.timenorm.TimeSpan;
@@ -78,7 +79,7 @@ public class PrintFailedTimeNormalizatio
 
     String grammarPath = "/org/apache/ctakes/temporal/timenorm.en.grammar";
     URL grammarURL = PrintFailedTimeNormalizations.class.getResource(grammarPath);
-    TemporalExpressionParser parser = new TemporalExpressionParser(grammarURL);
+    TemporalExpressionParser parser = new TemporalExpressionParser(grammarURL, DefaultTokenizer$.MODULE$);
     for (Iterator<JCas> casIter = new JCasIterator(reader, aggregateBuilder.createAggregate());
casIter.hasNext();) {
       JCas jCas = casIter.next();
       JCas goldView = jCas.getView("GoldView");

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=1731747&r1=1731746&r2=1731747&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
Mon Feb 22 22:00:21 2016
@@ -23,7 +23,8 @@ import org.apache.ctakes.typesystem.type
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.CASException;
 import org.apache.uima.jcas.JCas;
-import org.threeten.bp.temporal.TemporalUnit;
+//import org.threeten.bp.temporal.TemporalUnit;
+import java.time.temporal.TemporalUnit;
 import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
 import org.apache.uima.fit.util.JCasUtil;
 
@@ -59,7 +60,7 @@ public class PrintNormalizedTemporalExpr
         scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
         while(iterator.hasNext()) {
           TemporalUnit unit = iterator.next();
-          System.out.println(timex + "|" + unit.getName());
+          System.out.println(timex + "|" + unit.toString());
         } 
       }
     }

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/ExtractDurationsUsingContainsRelation.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/ExtractDurationsUsingContainsRelation.java?rev=1731747&r1=1731746&r2=1731747&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/ExtractDurationsUsingContainsRelation.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/ExtractDurationsUsingContainsRelation.java
Mon Feb 22 22:00:21 2016
@@ -38,7 +38,8 @@ import org.apache.uima.cas.CASException;
 import org.apache.uima.collection.CollectionReader;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.resource.ResourceInitializationException;
-import org.threeten.bp.temporal.TemporalUnit;
+//import org.threeten.bp.temporal.TemporalUnit;
+import java.time.temporal.TemporalUnit;
 import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
 import org.apache.uima.fit.descriptor.ConfigurationParameter;
 import org.apache.uima.fit.factory.AnalysisEngineFactory;
@@ -166,7 +167,7 @@ public class ExtractDurationsUsingContai
         scala.collection.Iterator<TemporalUnit> iterator = units.iterator();
         while(iterator.hasNext()) {
           TemporalUnit unit = iterator.next();
-          String coarseUnit = Utils.putInBin(unit.getName());
+          String coarseUnit = Utils.putInBin(unit.toString());
           if(coarseUnit != null) {
             if(eventTimeUnitCount.containsKey(eventText)) {
               eventTimeUnitCount.get(eventText).add(coarseUnit);



Mime
View raw message