ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1860655 - in /ctakes/trunk: ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper
Date Wed, 05 Jun 2019 12:36:02 GMT
Author: seanfinan
Date: Wed Jun  5 12:36:01 2019
New Revision: 1860655

URL: http://svn.apache.org/viewvc?rev=1860655&view=rev
Log:
Xmi Reader that can accept directories

Added:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java
    ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java?rev=1860655&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java (added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/XmiTreeReader.java Wed
Jun  5 12:36:01 2019
@@ -0,0 +1,40 @@
+package org.apache.ctakes.core.cr;
+
+import org.apache.ctakes.core.pipeline.PipeBitInfo;
+import org.apache.uima.cas.impl.XmiCasDeserializer;
+import org.apache.uima.jcas.JCas;
+import org.xml.sax.SAXException;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 6/5/2019
+ */
+@PipeBitInfo(
+      name = "XMI Tree Reader",
+      description = "Reads document texts and annotations from XMI files in a directory tree.",
+      role = PipeBitInfo.Role.READER,
+      products = { PipeBitInfo.TypeProduct.DOCUMENT_ID }
+)
+final public class XmiTreeReader extends AbstractFileTreeReader {
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   protected void readFile( final JCas jCas, final File file ) throws IOException {
+      jCas.reset();
+      try ( FileInputStream inputStream = new FileInputStream( file ) ) {
+         XmiCasDeserializer.deserialize( new BufferedInputStream( inputStream ), jCas.getCas()
);
+      } catch ( SAXException saxE ) {
+         throw new IOException( saxE );
+      }
+   }
+
+}

Added: ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper?rev=1860655&view=auto
==============================================================================
--- ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper
(added)
+++ ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/pipeline/XmiToPretty.piper
Wed Jun  5 12:36:01 2019
@@ -0,0 +1,14 @@
+// Read XMI File using -i from the command line to specify input file
+reader XmiTreeReader
+
+// Write html
+add html.HtmlTextWriter
+
+// write -marked- plaintext
+add pretty.plaintext.PrettyTextWriterFit
+
+// write property list
+add property.plaintext.PropertyTextWriterFit
+
+// Announce completion
+addLast util.FinishedLogger



Mime
View raw message