uima-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r998944 - /uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java
Date Mon, 20 Sep 2010 14:31:24 GMT
Author: tommaso
Date: Mon Sep 20 14:31:24 2010
New Revision: 998944

URL: http://svn.apache.org/viewvc?rev=998944&view=rev
Log:
[UIMA-1863] - fixed reverse annotations building, end annotation index was wrong

Modified:
    uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java

Modified: uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java?rev=998944&r1=998943&r2=998944&view=diff
==============================================================================
--- uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java
(original)
+++ uima/sandbox/trunk/AlchemyAPIAnnotator/src/main/java/org/apache/uima/alchemy/mapper/processor/RankedEntitiesProcessor.java
Mon Sep 20 14:31:24 2010
@@ -18,28 +18,27 @@
  */
 package org.apache.uima.alchemy.mapper.processor;
 
+import org.apache.uima.UIMAFramework;
 import org.apache.uima.alchemy.digester.domain.EntitiesResults;
 import org.apache.uima.alchemy.digester.domain.Entity;
 import org.apache.uima.alchemy.digester.domain.Results;
 import org.apache.uima.alchemy.ts.entity.AlchemyAnnotation;
 import org.apache.uima.alchemy.ts.entity.BaseEntity;
-import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.cas.NonEmptyFSList;
 import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.util.Level;
 
 public class RankedEntitiesProcessor implements AlchemyOutputProcessor {
 
   private static final String ENTITY_PACKAGE_NAME = "org.apache.uima.alchemy.ts.entity.";
 
   public void process(JCas cas, Results results) throws Exception {
-
     for (Entity entity : ((EntitiesResults) results).getEntities().getEntities()) {
 
-      FeatureStructure fs = null;
       // get feature structure for the entity
-      fs = getFeatureStructure(entity.getType(), cas);
+      BaseEntity fs = getFeatureStructure(entity.getType(), cas);
 
       if (fs != null) {
 
@@ -90,7 +89,7 @@ public class RankedEntitiesProcessor imp
         }
         cas.addFsToIndexes(fs);
         /* build annotations on this fs */
-        buildAnnotations(cas, (BaseEntity) fs);
+        buildAnnotations(cas, fs);
       }
     }
   }
@@ -102,18 +101,18 @@ public class RankedEntitiesProcessor imp
     int annotationStart = cas.getDocumentText().indexOf(entityText);
     if (annotationStart > 0) {
       // create annotation
-      AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas, annotationStart, entityText
+      AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas, annotationStart, annotationStart
+ entityText
               .length());
-      alchemyAnnotation.setAlchemyType(fs.getType().toString());
+      alchemyAnnotation.setAlchemyType(type.toString());
       alchemyAnnotation.addToIndexes();
+      UIMAFramework.getLogger().log(Level.INFO, new StringBuilder("added AlchemyAnnotation
for ").append(alchemyAnnotation.getCoveredText()).append(" of type ").append(type.toString()).toString());
       // update entity occurrences
       NonEmptyFSList list = (NonEmptyFSList) fs.getOccurrences();
-      if (list!=null) {
+      if (list != null) {
         NonEmptyFSList newTail = new NonEmptyFSList(cas);
         newTail.setHead(list.getHead());
         newTail.setTail(list.getTail());
-      }
-      else {
+      } else {
         list = new NonEmptyFSList(cas);
       }
       list.setHead(alchemyAnnotation);



Mime
View raw message