ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1465670 - in /ctakes/trunk: ctakes-dependency-parser-res/src/main/resources/org/apache/ctakes/dependency/parser/models/dependency/ ctakes-dependency-parser-res/src/main/resources/org/apache/ctakes/dependency/parser/models/srl/ ctakes-depen...
Date Mon, 08 Apr 2013 15:56:14 GMT
Author: chenpei
Date: Mon Apr  8 15:56:14 2013
New Revision: 1465670

URL: http://svn.apache.org/r1465670
Log:
CTAKES-96 - Remove old dummy Dependency Parser models (they no longer with the new ClearNLP
lib.  Defaulting the unit test to use the defaults.
Updating the unit tests- moved to src/test/java instead of src/main/java.

Added:
    ctakes/trunk/ctakes-dependency-parser/src/test/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/
    ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java
      - copied, changed from r1465043, ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java
Removed:
    ctakes/trunk/ctakes-dependency-parser-res/src/main/resources/org/apache/ctakes/dependency/parser/models/dependency/dummy.dep.mod.jar
    ctakes/trunk/ctakes-dependency-parser-res/src/main/resources/org/apache/ctakes/dependency/parser/models/srl/dummy.srl.mod.jar
    ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java

Copied: ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java
(from r1465043, ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java)
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java?p2=ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java&p1=ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java&r1=1465043&r2=1465670&rev=1465670&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java
(original)
+++ ctakes/trunk/ctakes-dependency-parser/src/test/java/org/apache/ctakes/dependency/parser/ae/util/TestClearNLPAnalysisEngines.java
Mon Apr  8 15:56:14 2013
@@ -20,6 +20,7 @@ package org.apache.ctakes.dependency.par
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URI;
 
 import org.apache.uima.UIMAException;
 import org.apache.uima.analysis_engine.AnalysisEngine;
@@ -29,6 +30,7 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.resource.metadata.TypeSystemDescription;
 import org.cleartk.util.Options_ImplBase;
 import org.cleartk.util.cr.FilesCollectionReader;
+import org.junit.Test;
 import org.kohsuke.args4j.Option;
 import org.uimafit.component.JCasAnnotator_ImplBase;
 import org.uimafit.factory.AnalysisEngineFactory;
@@ -52,32 +54,33 @@ import org.apache.ctakes.typesystem.type
  * @author lbecker
  *
  */
-public class TestClearNLPAnalysisEngines {
-	public static String DEP_DUMMY_MODEL_FILE = "src/resources/dependency/dummy.dep.mod.jar";
-	public static String SRL_DUMMY_MODEL_FILE = "src/resources/srl/dummy.srl.mod.jar";
-	public static String INPUT_FILE = "../ctakes-clinical-pipeline/test/data/plaintext/testpatient_plaintext_1.txt";
-
-
+public class TestClearNLPAnalysisEngines{
+	
+	// Create dependency parsers analysis engine with the default models
+	// The dummy models from ClearParser haven't been updated to work with ClearNLP.
+	//public static final String DEP_DUMMY_MODEL_FILE = "org/apache/ctakes/dependency/parser/models/dependency/dummy.dep.mod.jar";
+	//public static final String SRL_DUMMY_MODEL_FILE = "org/apache/ctakes/dependency/parser/models/srl/dummy.srl.mod.jar";
+	public static String INPUT_FILE = "../ctakes-clinical-pipeline/src/test/data/plaintext/testpatient_plaintext_1.txt";
 	public static class Options extends Options_ImplBase {
 		
 		@Option(name = "-d",
 				aliases = "--depModelFile",
 				usage = "specify the path to the dependency parser model file",
 				required = false)
-		public File depModelFile = new File(DEP_DUMMY_MODEL_FILE);
+		public String depModelFile = null;
 		
 		@Option(name = "-s",
 				aliases = "--srlModelFile",
 				usage = "specify the path to the ClearNLP srl model file",
 				required = false)
-		public File srlModelFile = new File(SRL_DUMMY_MODEL_FILE);
+		public String srlModelFile = null;
 		
 		
 		@Option(name = "-i",
 				aliases = "--inputFile",
 				usage = "specify the path to the plaintext input",
 				required = false)
-		public File inputFile = new File(INPUT_FILE);
+		public String inputFile = INPUT_FILE;
 	}
 
 	
@@ -101,58 +104,41 @@ public class TestClearNLPAnalysisEngines
 		}
 	}
 	
-
-	/**
-	 * @param args
-	 * @throws IOException 
-	 * @throws UIMAException 
-	 * @throws SAXException 
-	 */
-	public static void main(String[] args) throws IOException, UIMAException, SAXException {
-		Options options = new Options();
-		options.parseOptions(args);
-
-		File depModelFile = options.depModelFile;
-		File srlModelFile = options.srlModelFile;
-		File inputFile = options.inputFile;
-		
-		TypeSystemDescription typeSystem = TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath("../ctakes-type-system/desc/common_type_system.xml");
-				
-		CollectionReader reader1 = CollectionReaderFactory.createCollectionReader(
-				FilesCollectionReader.class,
-				typeSystem,
-				FilesCollectionReader.PARAM_ROOT_FILE,
-				inputFile.toString()
-				);
-		
-		// Load preprocessing pipeline (consists of 
-		AnalysisEngine preprocessingAE = WriteClearNLPDescriptors.getPlaintextAggregateBuilder().createAggregate();
-		
-		
-		// Create dependency parsers analysis engine
-		AnalysisEngine ClearNLPDepParser = AnalysisEngineFactory.createPrimitive(
+
+	@Test
+	public void TestClearNLPPipeLine() throws Exception {
+		
+		TypeSystemDescription typeSystem = TypeSystemDescriptionFactory.createTypeSystemDescription();
+		
+		CollectionReader reader1 = CollectionReaderFactory.createCollectionReader(
+				FilesCollectionReader.class,
+				typeSystem,
+				FilesCollectionReader.PARAM_ROOT_FILE,
+				INPUT_FILE
+				);
+		
+		// Load preprocessing pipeline (consists of 
+		AnalysisEngine preprocessingAE = WriteClearNLPDescriptors.getPlaintextAggregateBuilder().createAggregate();
+		
+		// Create dependency parsers analysis engine with the default models
+		// The dummy models from ClearParser haven't been updated to work with ClearNLP.
+		AnalysisEngine ClearNLPDepParser = AnalysisEngineFactory.createPrimitive(
 				ClearNLPDependencyParserAE.class,
-				typeSystem,
-				ClearNLPDependencyParserAE.PARAM_PARSER_MODEL_FILE_NAME,
-				depModelFile.toString()
-				);
-	
-				
-		// Create analysis engine for SRL
-		AnalysisEngine ClearNLPSRL = AnalysisEngineFactory.createPrimitive(
+				typeSystem
+				);
+	
+				
+		// Create analysis engine for SRL
+		AnalysisEngine ClearNLPSRL = AnalysisEngineFactory.createPrimitive(
 				ClearNLPSemanticRoleLabelerAE.class,
-				typeSystem,
-				ClearNLPSemanticRoleLabelerAE.PARAM_PARSER_MODEL_FILE_NAME,
-				srlModelFile.toString()
-				);
-		
+				typeSystem
+				);
+		
+		AnalysisEngine dumpClearNLPOutput = AnalysisEngineFactory.createPrimitive(
+				DumpClearNLPOutputAE.class,
+				typeSystem);
+		
+		SimplePipeline.runPipeline(reader1, preprocessingAE, ClearNLPDepParser, ClearNLPSRL, dumpClearNLPOutput);

+	}
 	
-		
-		AnalysisEngine dumpClearNLPOutput = AnalysisEngineFactory.createPrimitive(
-				DumpClearNLPOutputAE.class,
-				typeSystem);
-		
-		SimplePipeline.runPipeline(reader1, preprocessingAE, ClearNLPDepParser, ClearNLPSRL, dumpClearNLPOutput);
-	}
-
 }



Mime
View raw message