Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AFDBF200B9A for ; Fri, 7 Oct 2016 17:25:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AEA13160AE8; Fri, 7 Oct 2016 15:25:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 00CC2160AD6 for ; Fri, 7 Oct 2016 17:25:56 +0200 (CEST) Received: (qmail 80975 invoked by uid 500); 7 Oct 2016 15:25:55 -0000 Mailing-List: contact commits-help@ctakes.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ctakes.apache.org Delivered-To: mailing list commits@ctakes.apache.org Received: (qmail 80966 invoked by uid 99); 7 Oct 2016 15:25:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Oct 2016 15:25:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 45BB2C05AC for ; Fri, 7 Oct 2016 15:25:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 5iv0lkqeAz5j for ; Fri, 7 Oct 2016 15:25:54 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 168445F56F for ; Fri, 7 Oct 2016 15:25:54 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 34A81E002B for ; Fri, 7 Oct 2016 15:25:53 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 0C9803A023D for ; Fri, 7 Oct 2016 15:25:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@ctakes.apache.org From: dligach@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161007152553.0C9803A023D@svn01-us-west.apache.org> archived-at: Fri, 07 Oct 2016 15:25:57 -0000 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, BinaryTextRelation> relationLookup, + protected String getRelationCategory3(Map, 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, 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) {