ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1764310 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java
Date Tue, 11 Oct 2016 17:05:54 GMT
Author: dligach
Date: Tue Oct 11 17:05:54 2016
New Revision: 1764310

URL: http://svn.apache.org/viewvc?rev=1764310&view=rev
Log:
fixed issues with times and events that couldn't be found based on offsets

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java?rev=1764310&r1=1764309&r2=1764310&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/data/EventTimeRelPositionPrinter.java
Tue Oct 11 17:05:54 2016
@@ -325,6 +325,7 @@ public class EventTimeRelPositionPrinter
       tokens.add(baseToken.getCoveredText());  
     }
     
+    // find the positions of time and event mentions
     // assume time consists of multipe words; event of one
     int currentPosition = 0;       // current token index
     int timeFirstPosition = -1000; // timex's start index
@@ -343,6 +344,35 @@ public class EventTimeRelPositionPrinter
       currentPosition++;
     }
 
+    // try to locate events that weren't found
+    // e.g. "this can be re-discussed tomorrow"
+    // "discussed" not found due to incorrect tokenization
+    if(eventPosition == -1000) {
+      currentPosition = 0;
+      for(BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, sent)) {
+        if(token.getCoveredText().contains(event.getCoveredText())) {
+          eventPosition = currentPosition; 
+        }
+        currentPosition++;
+      }
+    }
+    
+    if(eventPosition == -1000) {
+      System.out.println("event not found: " + event.getCoveredText());
+      System.out.println(sent.getCoveredText());
+      System.out.println();
+      eventPosition = 0; // just set it to zero for now
+    }
+
+    // now need to see if some times weren't found
+    if(timeFirstPosition == -1000 || timeLastPosition == -1000) {
+      System.out.println("time not found: " + time.getCoveredText());
+      System.out.println(sent.getCoveredText());
+      System.out.println();
+      timeFirstPosition = 0; // just set it to zero for now
+      timeLastPosition = 0;  // just set it to zero for now
+    }
+    
     List<String> positionsWrtToTime = new ArrayList<>();
     List<String> positionsWrtToEvent = new ArrayList<>();
     int tokensInSentence = JCasUtil.selectCovered(jCas, BaseToken.class, sent).size();



Mime
View raw message