ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1745542 - /ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
Date Wed, 25 May 2016 21:23:51 GMT
Author: dligach
Date: Wed May 25 21:23:51 2016
New Revision: 1745542

URL: http://svn.apache.org/viewvc?rev=1745542&view=rev
Log:
including words on the right and left of the args

Modified:
    ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java

Modified: ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java?rev=1745542&r1=1745541&r2=1745542&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
(original)
+++ ctakes/sandbox/ctakes-wsd/src/main/java/org/apache/ctakes/pipelines/PositiveAndNegativeExamplePrinter.java
Wed May 25 21:23:51 2016
@@ -150,13 +150,20 @@ public class PositiveAndNegativeExampleP
 
   public static String getTextBetween(JCas jCas, Annotation arg1, Annotation arg2)  {
     
-    List<BaseToken> baseTokens = JCasUtil.selectBetween(jCas, BaseToken.class, arg1,
arg2);
     StringBuilder tokens = new StringBuilder();
+    List<BaseToken> preceeding = JCasUtil.selectPreceding(jCas, BaseToken.class, arg1,
1);
+    tokens.append(preceeding.get(0).getCoveredText() + " ");
+    
+    List<BaseToken> baseTokens = JCasUtil.selectBetween(jCas, BaseToken.class, arg1,
arg2);
     tokens.append("<arg1-start> " + arg1.getCoveredText() + " <arg1-end> ");
     for(BaseToken baseToken : baseTokens) {
       tokens.append(baseToken.getCoveredText() + " ");
     }
-    tokens.append("<arg2-start> " + arg2.getCoveredText() + " <arg2-end>");
+    tokens.append("<arg2-start> " + arg2.getCoveredText() + " <arg2-end> ");
+
+    List<BaseToken> following = JCasUtil.selectFollowing(jCas, BaseToken.class, arg1,
1);
+    tokens.append(following.get(0).getCoveredText());
+
     
     return tokens.toString().replaceAll("[\r\n]", " ");
   }



Mime
View raw message