Author: seanfinan
Date: Sat Oct 15 01:14:26 2016
New Revision: 1765003

URL: http://svn.apache.org/viewvc?rev=1765003&view=rev
Log:
Adding ProcessDir.piper
Refactoring

Added:
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirBuilderRunner.java
      - copied, changed from r1765001, 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/DirNotesBuildPipeRunner.java
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirPiperRunner.java
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorld.piper
      - copied unchanged from r1764965, 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldAssertProps.piper
      - copied unchanged from r1764816, 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldAssertPropsPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldCui.piper
      - copied unchanged from r1764965, 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldCuiPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldProps.piper
      - copied unchanged from r1764816, 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldPropsPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldTkProps.piper
      - copied unchanged from r1764965, 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldTkPropsPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/ProcessDir.piper
Removed:
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/DirNotesBuildPipeRunner.java
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldAssertPropsPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldCuiPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldPropsPipeline.piper
    
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/HelloWorldTkPropsPipeline.piper
Modified:
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldCuiPiperRunner.java
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPiperRunner.java
    
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPropsPiperRunner.java

Modified: 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldCuiPiperRunner.java
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldCuiPiperRunner.java?rev=1765003&r1=1765002&r2=1765003&view=diff
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldCuiPiperRunner.java
 (original)
+++ 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldCuiPiperRunner.java
 Sat Oct 15 01:14:26 2016
@@ -23,7 +23,7 @@ final public class HelloWorldCuiPiperRun
 
    static private final Logger LOGGER = Logger.getLogger( 
"HelloWorldCuiPiperRunner" );
 
-   static private final String PIPELINE_FILE_PATH = 
"org/apache/ctakes/examples/pipeline/HelloWorldCuiPipeline.piper";
+   static private final String PIPER_FILE_PATH = 
"org/apache/ctakes/examples/pipeline/HelloWorldCui.piper";
 
    static private final String DOC_TEXT = "Hello World!  I have allergies to 
nuts, bee stings, and shark bites.";
 
@@ -36,7 +36,7 @@ final public class HelloWorldCuiPiperRun
    public static void main( final String... args ) {
       try {
          // Add a simple pre-defined existing pipeline for Tokenization from 
file
-         final PiperFileReader reader = new PiperFileReader( 
PIPELINE_FILE_PATH );
+         final PiperFileReader reader = new PiperFileReader( PIPER_FILE_PATH );
          PipelineBuilder builder = reader.getBuilder();
          if ( args.length > 0 ) {
             // Example to save the Aggregate descriptor to an xml file for 
external use such as the UIMA CVD
@@ -44,11 +44,11 @@ final public class HelloWorldCuiPiperRun
          }
          // Run the pipeline with specified text
          builder.run( DOC_TEXT );
+         // Log the IdentifiedAnnotation objects
+         LOGGER.info( "\n" + CuiCollector.getInstance().toString() );
       } catch ( IOException | UIMAException multE ) {
          LOGGER.error( multE.getMessage() );
       }
-      // Log the IdentifiedAnnotation objects
-      LOGGER.info( "\n" + CuiCollector.getInstance().toString() );
    }
 
 

Modified: 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPiperRunner.java
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPiperRunner.java?rev=1765003&r1=1765002&r2=1765003&view=diff
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPiperRunner.java
 (original)
+++ 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPiperRunner.java
 Sat Oct 15 01:14:26 2016
@@ -22,7 +22,7 @@ final public class HelloWorldPiperRunner
 
    static private final Logger LOGGER = Logger.getLogger( 
"HelloWorldPiperRunner" );
 
-   static private final String PIPELINE_FILE_PATH = 
"org/apache/ctakes/examples/pipeline/HelloWorldPipeline.piper";
+   static private final String PIPER_FILE_PATH = 
"org/apache/ctakes/examples/pipeline/HelloWorld.piper";
 
    static private final String DOC_TEXT = "Hello World!";
 
@@ -35,7 +35,7 @@ final public class HelloWorldPiperRunner
    public static void main( final String... args ) {
       try {
          // Add a simple pre-defined existing pipeline for Tokenization from 
file
-         final PiperFileReader reader = new PiperFileReader( 
PIPELINE_FILE_PATH );
+         final PiperFileReader reader = new PiperFileReader( PIPER_FILE_PATH );
          PipelineBuilder builder = reader.getBuilder();
          if ( args.length > 0 ) {
             // Example to save the Aggregate descriptor to an xml file for 
external use such as the UIMA CVD

Modified: 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPropsPiperRunner.java
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPropsPiperRunner.java?rev=1765003&r1=1765002&r2=1765003&view=diff
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPropsPiperRunner.java
 (original)
+++ 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/HelloWorldPropsPiperRunner.java
 Sat Oct 15 01:14:26 2016
@@ -23,8 +23,8 @@ final public class HelloWorldPropsPiperR
 
    static private final Logger LOGGER = Logger.getLogger( 
"HelloWorldPropsPiperRunner" );
 
-   static private final String PROPS_PIPELINE_FILE_PATH
-         = "org/apache/ctakes/examples/pipeline/HelloWorldPropsPipeline.piper";
+   static private final String PIPER_FILE_PATH
+         = "org/apache/ctakes/examples/pipeline/HelloWorldProps.piper";
 
    static private final String DOC_TEXT
          = "Hello World!  I feel no pain.  My father takes aspirin.  My sister 
might have a headache.";
@@ -38,7 +38,7 @@ final public class HelloWorldPropsPiperR
    public static void main( final String... args ) {
       try {
          // Add a simple pre-defined existing pipeline for Tokenization from 
file
-         final PiperFileReader reader = new PiperFileReader( 
PROPS_PIPELINE_FILE_PATH );
+         final PiperFileReader reader = new PiperFileReader( PIPER_FILE_PATH );
          // Add the property extraction pipeline
          PipelineBuilder builder = reader.getBuilder();
          if ( args.length > 0 ) {
@@ -47,11 +47,11 @@ final public class HelloWorldPropsPiperR
          }
          // Run the pipeline with specified text
          builder.run( DOC_TEXT );
+         // Log the IdentifiedAnnotation objects
+         LOGGER.info( "\n" + EntityCollector.getInstance().toString() );
       } catch ( IOException | UIMAException multE ) {
          LOGGER.error( multE.getMessage() );
       }
-      // Log the IdentifiedAnnotation objects
-      LOGGER.info( "\n" + EntityCollector.getInstance().toString() );
    }
 
 

Copied: 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirBuilderRunner.java
 (from r1765001, 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/DirNotesBuildPipeRunner.java)
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirBuilderRunner.java?p2=ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirBuilderRunner.java&p1=ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/DirNotesBuildPipeRunner.java&r1=1765001&r2=1765003&rev=1765003&view=diff
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/DirNotesBuildPipeRunner.java
 (original)
+++ 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirBuilderRunner.java
 Sat Oct 15 01:14:26 2016
@@ -19,13 +19,13 @@ import java.io.IOException;
  * @version %I%
  * @since 10/12/2016
  */
-final public class DirNotesBuildPipeRunner {
+final public class ProcessDirBuilderRunner {
 
-   static private final Logger LOGGER = Logger.getLogger( 
"DirNotesBuildPipeRunner" );
+   static private final Logger LOGGER = Logger.getLogger( 
"ProcessDirBuilderRunner" );
 
    static private final String INPUT_DIR = "org/apache/ctakes/examples/notes";
 
-   private DirNotesBuildPipeRunner() {
+   private ProcessDirBuilderRunner() {
    }
 
    /**

Added: 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirPiperRunner.java
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirPiperRunner.java?rev=1765003&view=auto
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirPiperRunner.java
 (added)
+++ 
ctakes/trunk/ctakes-examples/src/main/java/org/apache/ctakes/examples/pipeline/ProcessDirPiperRunner.java
 Sat Oct 15 01:14:26 2016
@@ -0,0 +1,54 @@
+package org.apache.ctakes.examples.pipeline;
+
+
+import org.apache.ctakes.core.pipeline.EntityCollector;
+import org.apache.ctakes.core.pipeline.PipelineBuilder;
+import org.apache.ctakes.core.pipeline.PiperFileReader;
+import org.apache.log4j.Logger;
+import org.apache.uima.UIMAException;
+
+import java.io.IOException;
+
+/**
+ * Build and run a pipeline using a {@link PiperFileReader} and a {@link 
PipelineBuilder}.
+ * <p>
+ * Example of a running a pipeline programatically w/o uima xml descriptor xml 
files
+ * Adds the default Tokenization pipeline and adding the Example HelloWorld 
Annotator
+ *
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 10/10/2016
+ */
+final public class ProcessDirPiperRunner {
+
+   static private final Logger LOGGER = Logger.getLogger( 
"ProcessDirPiperRunner" );
+
+   static private final String PIPER_FILE_PATH = 
"org/apache/ctakes/examples/pipeline/ProcessDir.piper";
+
+   private ProcessDirPiperRunner() {
+   }
+
+   /**
+    * @param args an output directory for xmi files or none if xmi files are 
not wanted
+    */
+   public static void main( final String... args ) {
+      try {
+         // Add a simple pre-defined existing pipeline for Tokenization from 
file
+         final PiperFileReader reader = new PiperFileReader( PIPER_FILE_PATH );
+         // Add the property extraction pipeline
+         PipelineBuilder builder = reader.getBuilder();
+         if ( args.length > 0 ) {
+            // Example to save the Aggregate descriptor to an xml file for 
external use such as the UIMA CVD
+            builder.writeXMIs( args[ 0 ] );
+         }
+         // Run the pipeline with specified text
+         builder.run();
+         // Log the IdentifiedAnnotation objects
+         LOGGER.info( "\n" + EntityCollector.getInstance().toString() );
+      } catch ( IOException | UIMAException multE ) {
+         LOGGER.error( multE.getMessage() );
+      }
+   }
+
+
+}

Added: 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/ProcessDir.piper
URL: 
http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/ProcessDir.piper?rev=1765003&view=auto
==============================================================================
--- 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/ProcessDir.piper
 (added)
+++ 
ctakes/trunk/ctakes-examples/src/main/resources/org/apache/ctakes/examples/pipeline/ProcessDir.piper
 Sat Oct 15 01:14:26 2016
@@ -0,0 +1,21 @@
+// This file contains commands and parameters to run the ctakes-examples 
"Hello World" pipeline
+// with Entity Property output
+
+readFiles org/apache/ctakes/examples/notes
+
+// Load a simple token processing pipeline from another pipeline file
+load org/apache/ctakes/core/pipeline/DefaultTokenizerPipeline.piper
+
+// Add non-core annotators
+add ContextDependentTokenizerAnnotator
+// The POSTagger has a -complex- startup, but it can create its own 
description to handle it
+addDescription POSTagger
+
+// Add the context annotator for simple annotation properties
+// The default call sets it to detect negation
+add ContextAnnotator
+// It can also detect Status if you change some parameters from the defaults
+add ContextAnnotator 
ContextAnalyzerClass=org.apache.ctakes.necontexts.status.StatusContextAnalyzer 
ContextHitConsumerClass=org.apache.ctakes.necontexts.status.StatusContextHitConsumer
 MaxLeftScopeSize=10 MaxRightScopeSize=10
+
+// Collect discovered Entity information for post-run access
+collectEntities


Reply via email to