ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brittfi...@apache.org
Subject svn commit: r1716730 - in /ctakes/trunk: ctakes-context-tokenizer/desc/analysis_engine/ ctakes-context-tokenizer/src/test/ ctakes-context-tokenizer/src/test/java/ ctakes-context-tokenizer/src/test/java/org/ ctakes-context-tokenizer/src/test/java/org/ap...
Date Thu, 26 Nov 2015 16:01:26 GMT
Author: brittfitch
Date: Thu Nov 26 16:01:26 2015
New Revision: 1716730

URL: http://svn.apache.org/viewvc?rev=1716730&view=rev
Log:
CTAKES-341
update FSM to interpret fractions better.

Added:
    ctakes/trunk/ctakes-context-tokenizer/src/test/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/
    ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java
  (with props)
Modified:
    ctakes/trunk/ctakes-context-tokenizer/desc/analysis_engine/AggregateAE.xml
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/fsm/machine/FractionFSM.java

Modified: ctakes/trunk/ctakes-context-tokenizer/desc/analysis_engine/AggregateAE.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-context-tokenizer/desc/analysis_engine/AggregateAE.xml?rev=1716730&r1=1716729&r2=1716730&view=diff
==============================================================================
--- ctakes/trunk/ctakes-context-tokenizer/desc/analysis_engine/AggregateAE.xml (original)
+++ ctakes/trunk/ctakes-context-tokenizer/desc/analysis_engine/AggregateAE.xml Thu Nov 26
16:01:26 2015
@@ -43,8 +43,8 @@
 <flowConstraints>
 <fixedFlow>
 <node>SimpleSegmentAnnotator</node>
-<node>TokenizerAnnotator</node>
 <node>SentenceDetectorAnnotator</node>
+<node>TokenizerAnnotator</node>
 <node>ContextDependentTokenizerAnnotator</node>
 </fixedFlow>
 </flowConstraints>

Added: ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java?rev=1716730&view=auto
==============================================================================
--- ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java
(added)
+++ ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java
Thu Nov 26 16:01:26 2015
@@ -0,0 +1,64 @@
+package org.apache.ctakes.contexttokenizer.ae;
+/**
+ * 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.
+ */
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.ctakes.core.fsm.output.FractionToken;
+import org.apache.ctakes.typesystem.type.textsem.FractionAnnotation;
+import org.apache.ctakes.typesystem.type.textspan.Segment;
+import org.apache.ctakes.utils.test.TestUtil;
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.junit.Test;
+import org.apache.uima.fit.factory.JCasFactory;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+import org.apache.uima.fit.util.JCasUtil;
+
+/**
+ * 
+ * @author brittfitch
+ *
+ */
+public class TestContextDependentTokenizerAnnotator {
+
+	@Test
+    public void testSimpleSegment() throws ResourceInitializationException {
+		AnalysisEngine ae = TestUtil.getAE(new File("desc/analysis_engine/AggregateAE.xml"));
+		JCas jCas = TestUtil.processAE(ae, "FOO 4.5 3.5-4.7 ");
+		String[] expected = new String[]{"4.5", "3.5", "4.7"};
+		List<FractionAnnotation> fracs = new ArrayList<>(JCasUtil.select(jCas, FractionAnnotation.class));
+		
+		assertEquals(3, fracs.size());
+		
+		for(int i=0; i<3; i++)
+		{
+			assertEquals(expected[i], fracs.get(i).getCoveredText());
+		}
+	}
+}

Propchange: ctakes/trunk/ctakes-context-tokenizer/src/test/java/org/apache/ctakes/contexttokenizer/ae/TestContextDependentTokenizerAnnotator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/fsm/machine/FractionFSM.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/fsm/machine/FractionFSM.java?rev=1716730&r1=1716729&r2=1716730&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/fsm/machine/FractionFSM.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/fsm/machine/FractionFSM.java
Thu Nov 26 16:01:26 2015
@@ -186,7 +186,12 @@ public class FractionFSM {
 					FractionToken fractionToken = new FractionToken(startToken
 							.getStartOffset(), endToken.getEndOffset());
 					fractionSet.add(fractionToken);
+					
+					//reset to START state
 					fsm.reset();
+					
+					//set current startIndex
+					tokenStartMap.put(fsm, tokenStartIndex);
 				}
 			}
 		}



Mime
View raw message