ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1800798 - /ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java
Date Tue, 04 Jul 2017 15:02:56 GMT
Author: tmill
Date: Tue Jul  4 15:02:56 2017
New Revision: 1800798

URL: http://svn.apache.org/viewvc?rev=1800798&view=rev
Log:
Add code for auto-generating aggregate descriptors for default parser and mimic-sentence-based
parser.

Added:
    ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java

Added: ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java?rev=1800798&view=auto
==============================================================================
--- ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java
(added)
+++ ctakes/trunk/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/util/GenerateDescriptors.java
Tue Jul  4 15:02:56 2017
@@ -0,0 +1,42 @@
+package org.apache.ctakes.constituency.parser.util;
+
+import org.apache.ctakes.constituency.parser.ae.ConstituencyParser;
+import org.apache.ctakes.core.ae.SentenceDetector;
+import org.apache.ctakes.core.ae.SentenceDetectorAnnotatorBIO;
+import org.apache.ctakes.core.ae.SimpleSegmentAnnotator;
+import org.apache.ctakes.core.ae.TokenizerAnnotatorPTB;
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.fit.factory.AggregateBuilder;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.xml.sax.SAXException;
+import sun.java2d.pipe.SpanShapeRenderer;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * Created by miller on 7/4/17.
+ */
+public class GenerateDescriptors {
+    public static void main(String[] args) throws UIMAException, IOException, SAXException
{
+        AggregateBuilder builder = new AggregateBuilder();
+        builder.add(AnalysisEngineFactory.createEngineDescription(SimpleSegmentAnnotator.class));
+        builder.add(AnalysisEngineFactory.createEngineDescription(
+                SentenceDetector.class,
+                SentenceDetector.SD_MODEL_FILE_PARAM,
+                "org/apache/ctakes/core/sentdetect/sd-med-model.zip"));
+        builder.add(AnalysisEngineFactory.createEngineDescription(TokenizerAnnotatorPTB.class));
+        builder.add(AnalysisEngineFactory.createEngineDescription(ConstituencyParser.class));
+        AnalysisEngineDescription defaultDescriptor = builder.createAggregateDescription();
+        defaultDescriptor.toXML(new FileWriter("desc/analysis_engine/DefaultAggregateParsingProcessor.xml"));
+
+        builder = new AggregateBuilder();
+        builder.add(SimpleSegmentAnnotator.createAnnotatorDescription());
+        builder.add(SentenceDetectorAnnotatorBIO.getDescription());
+        builder.add(TokenizerAnnotatorPTB.createAnnotatorDescription());
+        builder.add(ConstituencyParser.createAnnotatorDescription());
+        AnalysisEngineDescription mimicDescriptor = builder.createAggregateDescription();
+        mimicDescriptor.toXML(new FileWriter("desc/analysis_engine/MimicAggregateParsingProcessor.xml"));
+    }
+}



Mime
View raw message