ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1587910 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java
Date Wed, 16 Apr 2014 14:02:24 GMT
Author: tmill
Date: Wed Apr 16 14:02:23 2014
New Revision: 1587910

URL: http://svn.apache.org/r1587910
Log:
CTAKES-295: Fix SimpleSegmentAnnotator to use uimafit-style configuration. Eliminates initialize()
method.

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java?rev=1587910&r1=1587909&r2=1587910&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/ae/SimpleSegmentAnnotator.java
Wed Apr 16 14:02:23 2014
@@ -18,14 +18,12 @@
  */
 package org.apache.ctakes.core.ae;
 
-import org.apache.uima.UimaContext;
-import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
-
 import org.apache.ctakes.core.util.DocumentIDAnnotationUtil;
 import org.apache.ctakes.typesystem.type.textspan.Segment;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
 
 /**
  * Creates a single segment annotation that spans the entire document. This is
@@ -35,21 +33,20 @@ import org.apache.ctakes.typesystem.type
  * @author Mayo Clinic
  */
 public class SimpleSegmentAnnotator extends JCasAnnotator_ImplBase {
+	
+  public static final String PARAM_SEGMENT_ID = "SegmentID";
+	@ConfigurationParameter(
+	    name = PARAM_SEGMENT_ID,
+	    mandatory = false,
+	    defaultValue = "SIMPLE_SEGMENT",
+	    description = "Name to give to all segments"
+	)
 	private String segmentId;
 
-	public void initialize(UimaContext aContext)
-			throws ResourceInitializationException {
-		super.initialize(aContext);
-
-		segmentId = (String) aContext.getConfigParameterValue("SegmentID");
-		if (segmentId == null) {
-			segmentId = "SIMPLE_SEGMENT";
-		}
-	}
-
 	/**
 	 * Entry point for processing.
 	 */
+	@Override
 	public void process(JCas jCas) throws AnalysisEngineProcessException {
 		Segment segment = new Segment(jCas);
 		segment.setBegin(0);



Mime
View raw message