You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by dl...@apache.org on 2015/08/06 21:32:57 UTC

svn commit: r1694560 - in /ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes: consumers/ pipelines/

Author: dligach
Date: Thu Aug  6 19:32:57 2015
New Revision: 1694560

URL: http://svn.apache.org/r1694560
Log:
refactoring + added a sentence printer consumer (for indexing sentences later)

Added:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/ClinicalConceptViewer.java
      - copied, changed from r1693617, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/ClinicalConceptViewer.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/PolysemyAnalysis.java
      - copied, changed from r1693615, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PolysemyAnalysis.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SemanticTypePrinter.java
      - copied, changed from r1693617, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/SemanticTypePrinter.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java   (with props)
Removed:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/ClinicalConceptViewer.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PolysemyAnalysis.java
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/SemanticTypePrinter.java
Modified:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java

Copied: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/ClinicalConceptViewer.java (from r1693617, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/ClinicalConceptViewer.java)
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/ClinicalConceptViewer.java?p2=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/ClinicalConceptViewer.java&p1=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/ClinicalConceptViewer.java&r1=1693617&r2=1694560&rev=1694560&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/ClinicalConceptViewer.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/ClinicalConceptViewer.java Thu Aug  6 19:32:57 2015
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ctakes.pipelines;
+package org.apache.ctakes.consumers;
 
 import java.io.File;
 

Copied: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/PolysemyAnalysis.java (from r1693615, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PolysemyAnalysis.java)
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/PolysemyAnalysis.java?p2=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/PolysemyAnalysis.java&p1=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PolysemyAnalysis.java&r1=1693615&r2=1694560&rev=1694560&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PolysemyAnalysis.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/PolysemyAnalysis.java Thu Aug  6 19:32:57 2015
@@ -1,4 +1,4 @@
-package org.apache.ctakes.pipelines;
+package org.apache.ctakes.consumers;
 
 import java.io.File;
 import java.util.Arrays;

Copied: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SemanticTypePrinter.java (from r1693617, ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/SemanticTypePrinter.java)
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SemanticTypePrinter.java?p2=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SemanticTypePrinter.java&p1=ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/SemanticTypePrinter.java&r1=1693617&r2=1694560&rev=1694560&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/SemanticTypePrinter.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SemanticTypePrinter.java Thu Aug  6 19:32:57 2015
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ctakes.pipelines;
+package org.apache.ctakes.consumers;
 
 import java.io.File;
 import java.util.ArrayList;

Added: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java?rev=1694560&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java (added)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java Thu Aug  6 19:32:57 2015
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.consumers;
+
+import java.io.File;
+
+import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.ctakes.utils.Utils;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.collection.CollectionReader;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+
+import com.lexicalscope.jewel.cli.CliFactory;
+import com.lexicalscope.jewel.cli.Option;
+
+/**
+ * Read cTAKES annotations from XMI files.
+ *  
+ * @author dmitriy dligach
+ */
+public class SentencePrinter {
+  
+  static interface Options {
+
+    @Option(
+        longName = "xmi-dir",
+        description = "path to xmi files")
+    public File getInputDirectory();
+  }
+  
+	public static void main(String[] args) throws Exception {
+		  
+		Options options = CliFactory.parseArguments(Options.class, args);
+    CollectionReader collectionReader = Utils.getCollectionReader(options.getInputDirectory());
+    AnalysisEngine annotationConsumer = AnalysisEngineFactory.createEngine(RelationContextPrinter.class);
+		SimplePipeline.runPipeline(collectionReader, annotationConsumer);
+	}
+
+  /**
+   * Print events and entities.
+   *  
+   * @author dmitriy dligach
+   */
+  public static class RelationContextPrinter extends JCasAnnotator_ImplBase {
+    
+    @Override
+    public void process(JCas jCas) throws AnalysisEngineProcessException {
+      
+      for(Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
+        System.out.println(sentence.getCoveredText());
+      }
+    }
+  }
+}
+
+  
\ No newline at end of file

Propchange: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/consumers/SentencePrinter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java?rev=1694560&r1=1694559&r2=1694560&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java (original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/BasicPipeline.java Thu Aug  6 19:32:57 2015
@@ -59,8 +59,8 @@ import com.google.common.io.CharStreams;
 
 public class BasicPipeline {
 
-  public static File inputDirectory = new File("/Users/Dima/Boston/Data/Sharp/FromSameer/Text/");
-  public static String outputDirectory = "/Users/Dima/Boston/Out/";
+  public static File inputDirectory = new File("/Users/dima/Boston/Data/DeepPhe/Text/");
+  public static String outputDirectory = "/Users/dima/Boston/Data/DeepPhe/Xmi/";
 
   public static void main(String[] args) throws Exception {