ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1480661 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal: ae/EventTimeRelationAnnotator.java data/analysis/EventContextAnalysisConsumer.java data/analysis/RelationContextAnalysisConsumer.java
Date Thu, 09 May 2013 14:24:38 GMT
Author: stevenbethard
Date: Thu May  9 14:24:38 2013
New Revision: 1480661

URL: http://svn.apache.org/r1480661
Log:
Fixes some warnings in ctakes-temporal

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java?rev=1480661&r1=1480660&r2=1480661&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
Thu May  9 14:24:38 2013
@@ -9,7 +9,6 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
-import org.apache.ctakes.temporal.ae.feature.UmlsFeatureExtractor;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;

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=1480661&r1=1480660&r2=1480661&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
Thu May  9 14:24:38 2013
@@ -77,35 +77,36 @@ public class EventContextAnalysisConsume
 
     BufferedWriter tokenWriter = getWriter(tokenOutputFile, true);
     BufferedWriter eventWriter = getWriter(eventOutputFile, true);
-      
-    for(BaseToken baseToken : JCasUtil.select(systemView, BaseToken.class)) {
-      String tokenText = baseToken.getCoveredText().toLowerCase();
-      String output = String.format("%s|%s\n", tokenText, getAnnotationContext(baseToken,
contextSize));
-      
-      try {
-        tokenWriter.write(output);
-      } catch (IOException e) {
-        throw new AnalysisEngineProcessException(e);
+    try {
+      for(BaseToken baseToken : JCasUtil.select(systemView, BaseToken.class)) {
+        String tokenText = baseToken.getCoveredText().toLowerCase();
+        String output = String.format("%s|%s\n", tokenText, getAnnotationContext(baseToken,
contextSize));
+        
+        try {
+          tokenWriter.write(output);
+        } catch (IOException e) {
+          throw new AnalysisEngineProcessException(e);
+        }
+      } 
+  
+      for(EventMention eventMention : JCasUtil.select(goldView, EventMention.class)) {
+        String eventText = eventMention.getCoveredText().toLowerCase();
+        String output = String.format("%s|%s\n", eventText, getAnnotationContext(eventMention,
contextSize));
+        
+        try {
+          eventWriter.write(output);
+        } catch (IOException e) {
+          throw new AnalysisEngineProcessException(e);
+        }
       }
-    } 
-
-    for(EventMention eventMention : JCasUtil.select(goldView, EventMention.class)) {
-      String eventText = eventMention.getCoveredText().toLowerCase();
-      String output = String.format("%s|%s\n", eventText, getAnnotationContext(eventMention,
contextSize));
-      
+    } finally {
       try {
-        eventWriter.write(output);
+        tokenWriter.close();
+        eventWriter.close();
       } catch (IOException e) {
         throw new AnalysisEngineProcessException(e);
       }
     }
-    
-    try {
-      tokenWriter.close();
-      eventWriter.close();
-    } catch (IOException e) {
-      throw new AnalysisEngineProcessException(e);
-    }
   }
 	
   private static String getAnnotationContext(Annotation annotation, int maxContextWindowSize)
{

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextAnalysisConsumer.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextAnalysisConsumer.java?rev=1480661&r1=1480660&r2=1480661&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextAnalysisConsumer.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/data/analysis/RelationContextAnalysisConsumer.java
Thu May  9 14:24:38 2013
@@ -63,28 +63,29 @@ public class RelationContextAnalysisCons
     }
 
     BufferedWriter writer = getWriter(outputFile, true);
-      
-    for(BinaryTextRelation binaryTextRelation : JCasUtil.select(goldView, BinaryTextRelation.class))
{
-      
-      Annotation arg1 = binaryTextRelation.getArg1().getArgument();
-      Annotation arg2 = binaryTextRelation.getArg2().getArgument();
-
-      String category = binaryTextRelation.getCategory();
-      String text = getTextBetweenAnnotations(systemView, arg1, arg2);
-      String output = String.format("%s|%s|%s|%s\n", category, arg1.getCoveredText(), arg2.getCoveredText(),
text);
-
+    try {
+      for(BinaryTextRelation binaryTextRelation : JCasUtil.select(goldView, BinaryTextRelation.class))
{
+        
+        Annotation arg1 = binaryTextRelation.getArg1().getArgument();
+        Annotation arg2 = binaryTextRelation.getArg2().getArgument();
+    
+        String category = binaryTextRelation.getCategory();
+        String text = getTextBetweenAnnotations(systemView, arg1, arg2);
+        String output = String.format("%s|%s|%s|%s\n", category, arg1.getCoveredText(), arg2.getCoveredText(),
text);
+    
+        try {
+          writer.write(output);
+        } catch (IOException e) {
+          throw new AnalysisEngineProcessException(e);
+        }
+      }
+    } finally {      
       try {
-        writer.write(output);
+        writer.close();
       } catch (IOException e) {
         throw new AnalysisEngineProcessException(e);
       }
     }
-    
-    try {
-      writer.close();
-    } catch (IOException e) {
-      throw new AnalysisEngineProcessException(e);
-    }
   }
 	
 	private static String getTextBetweenAnnotations(JCas jCas, Annotation arg1, Annotation arg2)
{



Mime
View raw message