ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1494148 - in /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion: eval/AssertionEvaluation.java medfacts/cleartk/AssertionCleartkAnalysisEngine.java
Date Tue, 18 Jun 2013 14:20:09 GMT
Author: swu
Date: Tue Jun 18 14:20:09 2013
New Revision: 1494148

URL: http://svn.apache.org/r1494148
Log:
assertion evaluation allows multiple input directories

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AssertionEvaluation.java
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AssertionEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AssertionEvaluation.java?rev=1494148&r1=1494147&r2=1494148&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AssertionEvaluation.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/AssertionEvaluation.java
Tue Jun 18 14:20:09 2013
@@ -116,7 +116,7 @@ public class AssertionEvaluation extends
         name = "--train-dir",
         usage = "specify the directory containing the XMI training files (for example, /NLP/Corpus/Relations/mipacq/xmi/train)",
         required = true)
-    public File trainDirectory;
+    public String trainDirectory;
     
     @Option(
         name = "--test-dir",
@@ -250,7 +250,13 @@ protected static Options options = new O
 //    System.err.println("forcing skipping of conditional processing!!!");
 //    options.runConditional = false;
     printOptionsForDebugging(options);
-    List<File> trainFiles = Arrays.asList(options.trainDirectory.listFiles());
+    String[] dirs = options.trainDirectory.split("[;:]");
+    List<File> trainFiles = new ArrayList<File>();
+    for (String dir : dirs) {
+    	File trainDir = new File(dir);
+    	trainFiles.addAll(Arrays.asList(trainDir.listFiles()));
+    	System.out.println(trainFiles.toString());
+    }
     //File modelsDir = new File("models/modifier");
     File modelsDir = options.modelsDirectory;
     File evaluationOutputDirectory = options.evaluationOutputDirectory;
@@ -364,7 +370,7 @@ protected static Options options = new O
 	    "ignore generic: %b%n" +
 	    "ignore history: %b%n" +
 	    "%n%n",
-	    options.trainDirectory.getAbsolutePath(),
+	    options.trainDirectory,
 	    (options.testDirectory != null) ? options.testDirectory.getAbsolutePath() : "",
 	    options.modelsDirectory.getAbsolutePath(),
 	    options.crossValidationFolds,
@@ -429,8 +435,18 @@ public static void printScore(Map<String
 
   public static void preprocess(File preprocessDir ) throws ResourceInitializationException,
UIMAException, IOException {
 //	  File devDirectory = new File(options.trainDirectory.getParentFile() + File.separator
+ "dev");
-	  GoldEntityAndAttributeReaderPipelineForSeedCorpus.readSharpUmlsCem(
-			  preprocessDir, options.trainDirectory, options.testDirectory, options.devDirectory);
+	  File trainDir = null;
+	  if (options.trainDirectory.split("[;:]").length>1) {
+		  throw new IOException("Assertion preprocess wants to write to one train directory, but
you've supplied multiple.");
+	  } else {
+		  trainDir = new File(options.trainDirectory);
+	  }
+	  if (preprocessDir.getName().contains("i2b2")) {
+		  
+	  } else {
+		  GoldEntityAndAttributeReaderPipelineForSeedCorpus.readSharpUmlsCem(
+				  preprocessDir, trainDir, options.testDirectory, options.devDirectory);
+	  }
   }
   
   @Override

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java?rev=1494148&r1=1494147&r2=1494148&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/medfacts/cleartk/AssertionCleartkAnalysisEngine.java
Tue Jun 18 14:20:09 2013
@@ -91,19 +91,20 @@ public abstract class AssertionCleartkAn
   protected Random coin = new Random(0);
 
   
-  public ConllDependencyNode findAnnotationHead(JCas jcas, Annotation annotation) {
-		
-	    for (ConllDependencyNode depNode : JCasUtil.selectCovered(jcas, ConllDependencyNode.class,
annotation)) {
-	    	
-	    	ConllDependencyNode head = depNode.getHead();
-	    	if (head == null || head.getEnd() <= annotation.getBegin() || head.getBegin() >
annotation.getEnd()) {
-	    		// The head is outside the bounds of the annotation, so this node must be the annotation's
head
-	    		return depNode;
-	    	}
-	    }
-	    // Can this happen?
-	    return null;
-	}
+/* DEPRECATED: STW 2013/03/28.  Use DependencyUtility:getNominalHeadNode(jCas,annotation)
instead */
+//  public ConllDependencyNode findAnnotationHead(JCas jcas, Annotation annotation) {
+//		
+//	    for (ConllDependencyNode depNode : JCasUtil.selectCovered(jcas, ConllDependencyNode.class,
annotation)) {
+//	    	
+//	    	ConllDependencyNode head = depNode.getHead();
+//	    	if (head == null || head.getEnd() <= annotation.getBegin() || head.getBegin()
> annotation.getEnd()) {
+//	    		// The head is outside the bounds of the annotation, so this node must be the annotation's
head
+//	    		return depNode;
+//	    	}
+//	    }
+//	    // Can this happen?
+//	    return null;
+//	}
 
   
 	



Mime
View raw message