ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1750204 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java
Date Sat, 25 Jun 2016 14:13:24 GMT
Author: dligach
Date: Sat Jun 25 14:13:23 2016
New Revision: 1750204

URL: http://svn.apache.org/viewvc?rev=1750204&view=rev
Log:
minor refactoring

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java?rev=1750204&r1=1750203&r2=1750204&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/eventTimeRelationPrinter.java
Sat Jun 25 14:13:23 2016
@@ -33,6 +33,7 @@ import org.apache.ctakes.temporal.durati
 import org.apache.ctakes.temporal.eval.CommandLine;
 import org.apache.ctakes.temporal.eval.THYMEData;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
+import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
@@ -146,7 +147,7 @@ public class eventTimeRelationPrinter {
       // can't iterate over binary text relations in a sentence, so need
       // a lookup from pair of annotations to binary text relation
       Map<List<Annotation>, BinaryTextRelation> relationLookup = new HashMap<>();
-      for(BinaryTextRelation relation : JCasUtil.select(goldView, BinaryTextRelation.class))
{
+      for(BinaryTextRelation relation : JCasUtil.select(goldView, TemporalTextRelation.class))
{
         Annotation arg1 = relation.getArg1().getArgument();
         Annotation arg2 = relation.getArg2().getArgument();
         relationLookup.put(Arrays.asList(arg1, arg2), relation);
@@ -154,8 +155,8 @@ public class eventTimeRelationPrinter {
 
       // go over sentences, extracting event-event relation instances
       for(Sentence sentence : JCasUtil.select(systemView, Sentence.class)) {
-        List<String> eventEventRelationsInSentence = new ArrayList<>();
-
+        List<String> eventTimeRelationsInSentence = new ArrayList<>();
+        
         // retrieve event-time relations in this sentence
         for(EventMention event : JCasUtil.selectCovered(goldView, EventMention.class, sentence))
{
           for(TimeMention time : JCasUtil.selectCovered(goldView, TimeMention.class, sentence))
{
@@ -189,12 +190,12 @@ public class eventTimeRelationPrinter {
             }
             
             String text = String.format("%s|%s", label, context);
-            eventEventRelationsInSentence.add(text.toLowerCase());
+            eventTimeRelationsInSentence.add(text.toLowerCase());
           }
         }  
 
         try {
-          Files.write(Paths.get(outputFile), eventEventRelationsInSentence, StandardOpenOption.APPEND);
+          Files.write(Paths.get(outputFile), eventTimeRelationsInSentence, StandardOpenOption.APPEND);
         } catch (IOException e) {
           e.printStackTrace();
         }
@@ -203,7 +204,7 @@ public class eventTimeRelationPrinter {
   }
 
   /**
-   * Return tokens between arg1 and arg2 as string 
+   * Print context from left to right.
    * @param contextSize number of tokens to include on the left of arg1 and on the right
of arg2
    */
   public static String getTokensBetween(



Mime
View raw message