ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1466608 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java
Date Wed, 10 Apr 2013 18:23:35 GMT
Author: dligach
Date: Wed Apr 10 18:23:35 2013
New Revision: 1466608

URL: http://svn.apache.org/r1466608
Log:
switched from using WordToken to BaseToken

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java?rev=1466608&r1=1466607&r2=1466608&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/EventContextAnalysisConsumer.java
Wed Apr 10 18:23:35 2013
@@ -22,7 +22,7 @@ import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
 
-import org.apache.ctakes.typesystem.type.syntax.WordToken;
+import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.CASException;
@@ -32,7 +32,7 @@ import org.uimafit.component.JCasAnnotat
 import org.uimafit.util.JCasUtil;
 
 /**
- * Print all tokens with contexts and all events with contexts for farther analysis.
+ * Print all tokens with contexts and all events with contexts for further analysis.
  * 
  * @author dmitriy dligach
  *
@@ -59,24 +59,34 @@ public class EventContextAnalysisConsume
       throw new AnalysisEngineProcessException(e);
     }
 
-    try {
-      BufferedWriter tokenWriter = getWriter(tokenFile, true);
-      for(WordToken wordToken : JCasUtil.select(systemView, WordToken.class)) {
-        String tokenText = wordToken.getCoveredText().toLowerCase();
-        String output = String.format("%s|%s\n", tokenText, getAnnotationContext(wordToken,
40));
+    BufferedWriter tokenWriter = getWriter(tokenFile, true);
+    BufferedWriter eventWriter = getWriter(eventFile, true);
+      
+    for(BaseToken baseToken : JCasUtil.select(systemView, BaseToken.class)) {
+      String tokenText = baseToken.getCoveredText().toLowerCase();
+      String output = String.format("%s|%s\n", tokenText, getAnnotationContext(baseToken,
40));
+      
+      try {
         tokenWriter.write(output);
+      } catch (IOException e) {
+        throw new AnalysisEngineProcessException(e);
       }
+    } 
 
-      BufferedWriter eventWriter = getWriter(eventFile, true);
-      for(EventMention eventMention : JCasUtil.select(goldView, EventMention.class)) {
-        String eventText = eventMention.getCoveredText().toLowerCase();
-        String output = String.format("%s|%s\n", eventText, getAnnotationContext(eventMention,
40));
+    for(EventMention eventMention : JCasUtil.select(goldView, EventMention.class)) {
+      String eventText = eventMention.getCoveredText().toLowerCase();
+      String output = String.format("%s|%s\n", eventText, getAnnotationContext(eventMention,
40));
+      
+      try {
         eventWriter.write(output);
+      } catch (IOException e) {
+        throw new AnalysisEngineProcessException(e);
       }
-      
+    }
+    
+    try {
       tokenWriter.close();
       eventWriter.close();
-      
     } catch (IOException e) {
       throw new AnalysisEngineProcessException(e);
     }



Mime
View raw message