ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattco...@apache.org
Subject svn commit: r1526708 - /ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java
Date Thu, 26 Sep 2013 21:27:22 GMT
Author: mattcoarr
Date: Thu Sep 26 21:27:22 2013
New Revision: 1526708

URL: http://svn.apache.org/r1526708
Log:
added class to generate xml descriptors for ctakes-assertion-zoner

Added:
    ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java

Added: ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java?rev=1526708&view=auto
==============================================================================
--- ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java
(added)
+++ ctakes/trunk/ctakes-assertion-zoner/src/main/java/org/mitre/medfacts/uima/CreateZonerDescriptor.java
Thu Sep 26 21:27:22 2013
@@ -0,0 +1,70 @@
+package org.mitre.medfacts.uima;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.ctakes.core.ae.DocumentIdPrinterAnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.uimafit.factory.AggregateBuilder;
+import org.uimafit.factory.AnalysisEngineFactory;
+import org.xml.sax.SAXException;
+
+public class CreateZonerDescriptor
+{
+
+  /**
+   * @param args
+   * @throws URISyntaxException 
+   * @throws FileNotFoundException 
+   * @throws ResourceInitializationException 
+   */
+  public static void main(String[] args) throws Exception
+  {
+    CreateZonerDescriptor creator = new CreateZonerDescriptor();
+    
+    creator.execute();
+
+  }
+  
+  public void execute() throws Exception
+  {
+    AggregateBuilder builder = new AggregateBuilder();
+
+//    AnalysisEngineDescription documentIdPrinter =
+//        AnalysisEngineFactory.createPrimitiveDescription(DocumentIdPrinterAnalysisEngine.class);
+//    builder.add(documentIdPrinter);
+  
+    URI generalSectionRegexFileUri =
+      this.getClass().getClassLoader().getResource("org/mitre/medfacts/uima/section_regex.xml").toURI();
+//    ExternalResourceDescription generalSectionRegexDescription = ExternalResourceFactory.createExternalResourceDescription(
+//        SectionRegexConfigurationResource.class, new File(generalSectionRegexFileUri));
+    AnalysisEngineDescription zonerAnnotator =
+        AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
+            ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
+            generalSectionRegexFileUri
+            );
+    builder.add(zonerAnnotator);
+
+    URI mayoSectionRegexFileUri =
+        this.getClass().getClassLoader().getResource("org/mitre/medfacts/uima/mayo_sections.xml").toURI();
+//      ExternalResourceDescription mayoSectionRegexDescription = ExternalResourceFactory.createExternalResourceDescription(
+//          SectionRegexConfigurationResource.class, new File(mayoSectionRegexFileUri));
+    AnalysisEngineDescription mayoZonerAnnotator =
+        AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
+            ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
+            mayoSectionRegexFileUri
+            );
+    builder.add(mayoZonerAnnotator);
+    
+    FileOutputStream outputStream = new FileOutputStream("desc/aggregateAssertionZoner.xml");
+    
+    AnalysisEngineDescription description = builder.createAggregateDescription();
+    
+    description.toXML(outputStream);
+  }
+
+}



Mime
View raw message