Return-Path: X-Original-To: apmail-ctakes-commits-archive@www.apache.org Delivered-To: apmail-ctakes-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D868F09E for ; Mon, 8 Apr 2013 15:56:39 +0000 (UTC) Received: (qmail 32843 invoked by uid 500); 8 Apr 2013 15:56:39 -0000 Delivered-To: apmail-ctakes-commits-archive@ctakes.apache.org Received: (qmail 32808 invoked by uid 500); 8 Apr 2013 15:56:39 -0000 Mailing-List: contact commits-help@ctakes.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ctakes.apache.org Delivered-To: mailing list commits@ctakes.apache.org Received: (qmail 32800 invoked by uid 99); 8 Apr 2013 15:56:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 15:56:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 15:56:35 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 92F6D23888E4; Mon, 8 Apr 2013 15:56:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@ctakes.apache.org From: chenpei@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130408155614.92F6D23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); - } - }