ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1707379 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java
Date Wed, 07 Oct 2015 20:16:02 GMT
Author: tmill
Date: Wed Oct  7 20:16:01 2015
New Revision: 1707379

URL: http://svn.apache.org/viewvc?rev=1707379&view=rev
Log:
Change feature extractor to not use newline tokens as features.

Modified:
    ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java

Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java?rev=1707379&r1=1707378&r2=1707379&view=diff
==============================================================================
--- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java
(original)
+++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/ModifierExtractorAnnotator.java
Wed Oct  7 20:16:01 2015
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
+import org.apache.ctakes.typesystem.type.syntax.NewlineToken;
 import org.apache.ctakes.typesystem.type.textsem.Modifier;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.UimaContext;
@@ -63,7 +64,11 @@ public class ModifierExtractorAnnotator
   @Override
   public void process(JCas jCas) throws AnalysisEngineProcessException {
     for (Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
-      List<BaseToken> tokens = JCasUtil.selectCovered(jCas, BaseToken.class, sentence);
+      List<BaseToken> tokens = new ArrayList<>();
+      for(BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, sentence)){
+        if(token instanceof NewlineToken) continue;
+        tokens.add(token);
+      }
 
       // during training, the list of all outcomes for the tokens
       List<String> outcomes;



Mime
View raw message