Return-Path: X-Original-To: apmail-ctakes-notifications-archive@www.apache.org Delivered-To: apmail-ctakes-notifications-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 69C5B10188 for ; Mon, 25 Nov 2013 13:17:42 +0000 (UTC) Received: (qmail 77184 invoked by uid 500); 25 Nov 2013 13:17:40 -0000 Delivered-To: apmail-ctakes-notifications-archive@ctakes.apache.org Received: (qmail 77129 invoked by uid 500); 25 Nov 2013 13:17:39 -0000 Mailing-List: contact notifications-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 notifications@ctakes.apache.org Received: (qmail 77102 invoked by uid 99); 25 Nov 2013 13:17:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Nov 2013 13:17:35 +0000 Date: Mon, 25 Nov 2013 13:17:35 +0000 (UTC) From: "Roberto Costumero Moreno (JIRA)" To: notifications@ctakes.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CTAKES-268) Fix SentenceDetector training with updated OpenNLP API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CTAKES-268?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Roberto Costumero Moreno updated CTAKES-268: -------------------------------------------- Description: Fixed the problem where SentenceDetector did not work as expected due to changes in the OpenNLP API. I have attached a patch file and the sentence file I have used and the model that it has generated. Seems to be working but need to be checked. I have successfully generated models from the examples and a new one in Spanish in which I am currently working. Updated: Attached new Patch. was: Fixed the problem where SentenceDetector did not work as expected due to changes in the OpenNLP API. I have attached a patch file and the sentence file I have used and the model that it has generated. I have changed code around line 300: logger.error("----------------------------------------------------------------------------------"); logger.error("Need to update yet for OpenNLP changes "); // TODO logger.error("Commented out code that no longer compiles due to OpenNLP API incompatible changes"); // TODO logger.error("----------------------------------------------------------------------------------"); FileReader datafr = new FileReader(inFile); EventStream es = new BasicEventStream(new PlainTextByLineDataStream(datafr)); GISModel mod = GIS.trainModel(es, iters, cut); SuffixSensitiveGISModelWriter ssgmw = new SuffixSensitiveGISModelWriter( mod, outFile); logger.info("Saving the model as: " + outFile.getAbsolutePath()); ssgmw.persist(); with this code: Charset charset = Charset.forName("UTF-8"); FileInputStream inStream = new FileInputStream(inFile); ObjectStream lineStream = new PlainTextByLineStream(inStream, charset); ObjectStream sampleStream = new SentenceSampleStream(lineStream); SentenceModel mod; try { mod = SentenceDetectorME.train("en", sampleStream, true, null, ModelUtil.createTrainingParameters(iters, cut)); } finally { sampleStream.close(); inStream.close(); } SuffixSensitiveGISModelWriter ssgmw = new SuffixSensitiveGISModelWriter( mod.getMaxentModel(), outFile); logger.info("Saving the model as: " + outFile.getAbsolutePath()); ssgmw.persist(); Seems to be working but need to be checked. I have successfully generated models from the examples and a new one in Spanish in which I am currently working. > Fix SentenceDetector training with updated OpenNLP API > ------------------------------------------------------ > > Key: CTAKES-268 > URL: https://issues.apache.org/jira/browse/CTAKES-268 > Project: cTAKES > Issue Type: Improvement > Components: ctakes-core > Affects Versions: 3.1, 3.2, 3.1.1 > Environment: Mac OS X > Reporter: Roberto Costumero Moreno > Labels: patch > Fix For: 3.1, 3.2, 3.1.1 > > Attachments: SentenceDetector.java.patch, sample_sd_en_en.mod, sample_sd_training_sentences.txt > > > Fixed the problem where SentenceDetector did not work as expected due to changes in the OpenNLP API. > I have attached a patch file and the sentence file I have used and the model that it has generated. > Seems to be working but need to be checked. I have successfully generated models from the examples and a new one in Spanish in which I am currently working. > Updated: Attached new Patch. -- This message was sent by Atlassian JIRA (v6.1#6144)