Return-Path: X-Original-To: apmail-ctakes-commits-archive@www.apache.org Delivered-To: apmail-ctakes-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C05F1100E9 for ; Tue, 9 Jul 2013 21:35:00 +0000 (UTC) Received: (qmail 48497 invoked by uid 500); 9 Jul 2013 21:35:00 -0000 Delivered-To: apmail-ctakes-commits-archive@ctakes.apache.org Received: (qmail 48463 invoked by uid 500); 9 Jul 2013 21:35:00 -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 48456 invoked by uid 99); 9 Jul 2013 21:35:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jul 2013 21:35:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jul 2013 21:34:57 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 14E9323889EC; Tue, 9 Jul 2013 21:34:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1501572 - /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java Date: Tue, 09 Jul 2013 21:34:37 -0000 To: commits@ctakes.apache.org From: james-masanz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130709213437.14E9323889EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: james-masanz Date: Tue Jul 9 21:34:36 2013 New Revision: 1501572 URL: http://svn.apache.org/r1501572 Log: use constant from AssertionConst for directory to get gold annotations from, changing this to get TestAssertionModels to work Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java?rev=1501572&r1=1501571&r2=1501572&view=diff ============================================================================== --- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java (original) +++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/eval/MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.java Tue Jul 9 21:34:36 2013 @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; +import org.apache.ctakes.assertion.util.AssertionConst; import org.apache.ctakes.core.util.DocumentIDAnnotationUtil; import org.apache.ctakes.typesystem.type.textsem.EntityMention; import org.apache.ctakes.typesystem.type.textsem.EventMention; @@ -65,7 +66,11 @@ public class MergeGoldViewFromOneCasInto static final Logger LOGGER = Logger.getLogger(MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.class.getName()); - private static final String dirWithGoldViews = "/SHARP-data/assertion/UMLS_CEM-gold-combined"; // TODO parameterize this + private static final String dirWithGoldViews = AssertionConst.testDirectories.get("polarity");// TODO parameterize this + static { + LOGGER.info("Copying information from gold views in " + dirWithGoldViews); + } + private static final File goldViewDir = new File(dirWithGoldViews); @Override @@ -78,6 +83,10 @@ public class MergeGoldViewFromOneCasInto */ @Override public void process(JCas jCas) throws AnalysisEngineProcessException { + + if (!goldViewDir.exists()) throw new AnalysisEngineProcessException(new RuntimeException("Directory with gold view annotations not found:" + dirWithGoldViews)); + if (!goldViewDir.isDirectory()) throw new AnalysisEngineProcessException(new RuntimeException("What is supposed to be a directory with gold view annotations is not a directory:" + dirWithGoldViews)); + String docId = DocumentIDAnnotationUtil.getDocumentID(jCas); JCas correspondingCasThatHasGoldAnnotations = getCorrespondingCasThatHasGoldAnnotations(docId); JCas viewWithPreexistingGoldAnnotations = null; @@ -91,8 +100,11 @@ public class MergeGoldViewFromOneCasInto //newGoldView = jCas.createView(AssertionEvaluation.GOLD_VIEW_NAME); newGoldView = ViewCreatorAnnotator.createViewSafely(jCas, AssertionEvaluation.GOLD_VIEW_NAME); + try { newGoldView.setSofaDataString(jCas.getSofaDataString(), jCas.getSofaMimeType()); - + } catch (org.apache.uima.cas.CASRuntimeException e) { + LOGGER.info("Warning, error setting sofa string - ignore if using TestAttributeModels"); + } int countCopied = 0; int countSkipped = 0;