ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1562078 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel: EventTimeFlatTreeFeatureExtractor.java TemporalPETExtractor.java TemporalPathExtractor.java
Date Tue, 28 Jan 2014 14:27:33 GMT
Author: tmill
Date: Tue Jan 28 14:27:33 2014
New Revision: 1562078

URL: http://svn.apache.org/r1562078
Log:
CTAKES-82: Add null check for contextual modality in tree kernel features -- needed for using
system inputs.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/EventTimeFlatTreeFeatureExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPETExtractor.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPathExtractor.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/EventTimeFlatTreeFeatureExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/EventTimeFlatTreeFeatureExtractor.java?rev=1562078&r1=1562077&r2=1562078&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/EventTimeFlatTreeFeatureExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/EventTimeFlatTreeFeatureExtractor.java
Tue Jan 28 14:27:33 2014
@@ -49,7 +49,10 @@ public class EventTimeFlatTreeFeatureExt
 	
 		// make sure we have the right classes
 		if(arg1 instanceof EventMention){
-			eventModality = ((EventMention)arg1).getEvent().getProperties().getContextualModality();
+		  EventMention mention = (EventMention) arg1;
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+		    eventModality = mention.getEvent().getProperties().getContextualModality();
+		  }
 			arg1Tree = new SimpleTree("EVENT-"+eventModality);
 		}else if(arg1 instanceof TimeMention){
 			timeClass = ((TimeMention)arg1).getTimeClass();
@@ -60,10 +63,9 @@ public class EventTimeFlatTreeFeatureExt
 		
 		if(arg2 instanceof EventMention){
 		  EventMention mention = (EventMention) arg2;
-		  if(mention.getEvent() == null || mention.getEvent().getProperties() == null){
-		    System.err.println("Something is null here!");
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+	      eventModality = mention.getEvent().getProperties().getContextualModality();
 		  }
-      eventModality = ((EventMention)arg2).getEvent().getProperties().getContextualModality();
       arg2Tree = new SimpleTree("EVENT-"+eventModality);		  
 		}else if(arg2 instanceof TimeMention){
       timeClass = ((TimeMention)arg2).getTimeClass();

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPETExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPETExtractor.java?rev=1562078&r1=1562077&r2=1562078&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPETExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPETExtractor.java
Tue Jan 28 14:27:33 2014
@@ -45,15 +45,21 @@ public class TemporalPETExtractor implem
 		String timeClass;
 		
 		if(arg1 instanceof EventMention){
-			eventModality = ((EventMention)arg1).getEvent().getProperties().getContextualModality();
-			a1type = "EVENT-"+eventModality;
+		  EventMention mention = (EventMention) arg1;
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+		    eventModality = mention.getEvent().getProperties().getContextualModality();
+		  }
+		  a1type = "EVENT-"+eventModality;
 		}else if(arg1 instanceof TimeMention){
 			timeClass = ((TimeMention)arg1).getTimeClass();	
 			a1type = "TIMEX-"+timeClass;
 		}
 		
 		if(arg2 instanceof EventMention){
-      eventModality = ((EventMention)arg2).getEvent().getProperties().getContextualModality();
+		  EventMention mention = (EventMention) arg2;
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+		    eventModality = mention.getEvent().getProperties().getContextualModality();
+		  }
       a2type = "EVENT-"+eventModality;		  
 		}else if(arg2 instanceof TimeMention){
       timeClass = ((TimeMention)arg2).getTimeClass();

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPathExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPathExtractor.java?rev=1562078&r1=1562077&r2=1562078&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPathExtractor.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel/TemporalPathExtractor.java
Tue Jan 28 14:27:33 2014
@@ -42,7 +42,10 @@ public class TemporalPathExtractor imple
 		String timeClass="";
 
 		if(arg1 instanceof EventMention){
-			eventModality = ((EventMention)arg1).getEvent().getProperties().getContextualModality();
+		  EventMention mention = (EventMention) arg1;
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+		    eventModality = mention.getEvent().getProperties().getContextualModality();
+		  }
 			a1type = "EVENT-"+eventModality;
 		}else if(arg1 instanceof TimeMention){
 			timeClass = ((TimeMention)arg1).getTimeClass();
@@ -50,13 +53,19 @@ public class TemporalPathExtractor imple
 		}
 		
 		if(arg2 instanceof EventMention){
-      eventModality = ((EventMention)arg2).getEvent().getProperties().getContextualModality();
+		  EventMention mention = (EventMention) arg2;
+		  if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
+		    eventModality = mention.getEvent().getProperties().getContextualModality();
+		  }
       a2type = "EVENT"+eventModality;		  
 		}else if(arg2 instanceof TimeMention){
       timeClass = ((TimeMention)arg2).getTimeClass();
       a2type = "TIMEX-"+timeClass;		  
 		}
 		
+		a1type = "";
+		a2type = "";
+		
 		TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1-"+a1type);
 		TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2-"+a2type);
 



Mime
View raw message