ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1763785 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
Date Fri, 07 Oct 2016 15:25:51 GMT
Author: dligach
Date: Fri Oct  7 15:25:51 2016
New Revision: 1763785

URL: http://svn.apache.org/viewvc?rev=1763785&view=rev
Log:
yet another way of getting relation label

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

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java?rev=1763785&r1=1763784&r2=1763785&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/nn/ae/EventEventTokenBasedAnnotator.java
Fri Oct  7 15:25:51 2016
@@ -152,7 +152,7 @@ public class EventEventTokenBasedAnnotat
    * @param arg2
    * @return
    */
-  protected String getRelationCategory(Map<List<Annotation>, BinaryTextRelation>
relationLookup,
+  protected String getRelationCategory3(Map<List<Annotation>, BinaryTextRelation>
relationLookup,
       IdentifiedAnnotation arg1,
       IdentifiedAnnotation arg2) {
     
@@ -160,23 +160,38 @@ public class EventEventTokenBasedAnnotat
     String category = null;
     if (relation != null) {
       category = relation.getCategory();
-      if(arg1 instanceof EventMention){
+      if(arg1 instanceof EventMention) {
         category = category + "-1";
       }
     } else {
       relation = relationLookup.get(Arrays.asList(arg2, arg1));
       if (relation != null) {
         category = relation.getCategory();
-        if(arg2 instanceof EventMention){
+        if(arg2 instanceof EventMention) {
           category = category + "-1";
         }
       }
     }
 
     return category;
-
   }
 
+  protected String getRelationCategory(Map<List<Annotation>, BinaryTextRelation>
relationLookup,
+      IdentifiedAnnotation arg1,
+      IdentifiedAnnotation arg2) {
+    
+    BinaryTextRelation forwardRelation = relationLookup.get(Arrays.asList(arg1, arg2));
+    BinaryTextRelation reverseRelation = relationLookup.get(Arrays.asList(arg2, arg1));
+    
+    String label = null;
+    if(forwardRelation != null) {
+      label = forwardRelation.getCategory(); // arg1 contains arg2
+    } else if(reverseRelation != null) {
+      label = reverseRelation.getCategory(); // arg2 contains arg1
+    }
+    
+    return label;
+  }
 
   protected void createRelation(JCas jCas, IdentifiedAnnotation arg1,
       IdentifiedAnnotation arg2, String predictedCategory, double confidence) {



Mime
View raw message