ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1586672 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/feature/treekernel: TemporalPETExtractor.java TemporalPathExtractor.java
Date Fri, 11 Apr 2014 15:00:05 GMT
Author: tmill
Date: Fri Apr 11 15:00:05 2014
New Revision: 1586672

URL: http://svn.apache.org/r1586672
Log:
CTAKES-82: Added code to allow gcg trees to be used in TK feature extractors.

Modified:
    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/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=1586672&r1=1586671&r2=1586672&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
Fri Apr 11 15:00:05 2014
@@ -84,6 +84,7 @@ public class TemporalPETExtractor implem
 
     tree.setGeneralizeLeaf(true);
 		moveTimexDownToNP(tree);
+		simplifyGCG(tree);
 		
 		features.add(new TreeFeature("TK_PET", tree.toString()));
 		return features;
@@ -127,4 +128,15 @@ public class TemporalPETExtractor implem
 		}
 	}
 
+	public static void simplifyGCG(SimpleTree tree){
+	  if(tree.children == null || tree.children.size() == 0) return;
+	  
+	  int ampInd = tree.cat.indexOf('+');
+	  if(ampInd > 0){
+	    tree.cat = tree.cat.substring(0, ampInd);
+	  }
+	  for(SimpleTree child : tree.children){
+	    simplifyGCG(child);
+	  }
+	}
 }

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=1586672&r1=1586671&r2=1586672&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
Fri Apr 11 15:00:05 2014
@@ -63,23 +63,12 @@ public class TemporalPathExtractor imple
       a2type = "TIMEX-"+timeClass;		  
 		}
 		
-		a1type = "";
-		a2type = "";
-		
 		TreebankNode t1 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg1, "ARG1-"+a1type);
 		TreebankNode t2 = AnnotationTreeUtils.insertAnnotationNode(jcas, root, arg2, "ARG2-"+a2type);
 
 		SimpleTree tree = null;
-//		if(t1.getBegin() <= t2.getBegin() && t1.getEnd() >= t2.getEnd()){
-//			// t1 encloses t2
-//			tree = TreeExtractor.getSimpleClone(t1);
-//		}else if(t2.getBegin() <= t1.getBegin() && t2.getEnd() >= t1.getEnd()){
-//			// t2 encloses t1
-//			tree = TreeExtractor.getSimpleClone(t2);
-//		}else{
 		tree = TreeExtractor.extractPathTree(t1, t2);
-//		}
-
+		TemporalPETExtractor.simplifyGCG(tree);
 		features.add(new TreeFeature("TK_PATH", tree.toString()));
 		return features;
 	}



Mime
View raw message