ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1524552 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
Date Wed, 18 Sep 2013 20:04:27 GMT
Author: dligach
Date: Wed Sep 18 20:04:27 2013
New Revision: 1524552

URL: http://svn.apache.org/r1524552
Log:
added two rules to filter out non-duration patterns

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java?rev=1524552&r1=1524551&r2=1524552&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/SignSymptomDurations.java
Wed Sep 18 20:04:27 2013
@@ -105,7 +105,10 @@ public class SignSymptomDurations {
 
       for(SignSymptomMention signSymptomMention : JCasUtil.select(jCas, SignSymptomMention.class))
{
         if(signSymptomMention.getCoveredText().equals(signSymptomText)) {
-      
+          if(isNegated(jCas, signSymptomMention) || isMedicationPattern(jCas, signSymptomMention))
{
+            continue;
+          }
+          
           TimeMention nearestTimeMention = getNearestTimeMention(jCas, signSymptomMention);
           if(nearestTimeMention != null) {
             Matcher matcher = pattern.matcher(nearestTimeMention.getCoveredText());
@@ -122,8 +125,38 @@ public class SignSymptomDurations {
 
       if(durationDistribution.size() > 0) { 
         // System.out.println(signSymptomText + "," + convertToString(durationDistribution));
-        // System.out.println(signSymptomText + ": " + durationDistribution);
+        System.out.println(signSymptomText + ": " + durationDistribution);
+      }
+    }
+    
+    /**
+     * Return true if sign/symptom is negated.
+     * TODO: using rules for now; switch to using a negation module
+     */
+    private static boolean isNegated(JCas jCas, SignSymptomMention signSymptomMention) {
+      
+      for(BaseToken token : JCasUtil.selectPreceding(jCas, BaseToken.class, signSymptomMention,
3)) {
+        if(token.getCoveredText().equals("no")) {
+          return true;
+        }
+      }
+      
+      return false;
+    }
+
+    /**
+     * Return true of this is a medication pattern. 
+     * E.g. five (5) ml po qid  (4 times a day) as needed for heartburn for 2 weeks.
+     */
+    private static boolean isMedicationPattern(JCas jCas, SignSymptomMention signSymptomMention)
{
+      
+      for(BaseToken token : JCasUtil.selectPreceding(jCas, BaseToken.class, signSymptomMention,
1)) {
+        if(token.getCoveredText().equals("for")) {
+          return true;
+        }
       }
+           
+      return false;
     }
     
     /**



Mime
View raw message