All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.coref.ace-pleonasm-print.jape Maven / Gradle / Ivy

Go to download

ANNIE is a general purpose information extraction system that provides the building blocks of many other GATE applications.

There is a newer version: 9.1
Show newest version
/*
*  pleonasm-print.jape
*
* Copyright (c) 1998-2004, The University of Sheffield.
*
*  This file is part of GATE (see http://gate.ac.uk/), and is free
*  software, licenced under the GNU Library General Public License,
*  Version 2, June 1991 (in the distribution as file licence.html,
*  and also available at http://gate.ac.uk/gate/licence.html).
*
*  Marin DImitrov, 21/Dec/2001
* 
*  $Id: ace-pleonasm-print.jape 5922 2004-07-21 17:10:11Z akshay $
*/


Phase:	PrintStats
Input: BODY TEXT
Options: control = brill debug=true

/**
* Run on Original markups. There is only 1 BODY/TEXT annotation in each doc, so 
* I'm using it as a way of having a rul called once per document so I can 
* print out the stats
*/



Rule:printStats1
Priority:5
(
  ({BODY} | {TEXT})
)
-->
{      
  //Print the overall coref stats
    try{
        String prefix = "";
        String fileName = "d:/prj/coref/results/RESULTS" + prefix +".csv";
    
        Writer out = new FileWriter(fileName, true);
        BufferedWriter buff = new BufferedWriter(out);
        PrintWriter pwr = new PrintWriter(buff);
    
        pwr.print(doc.getName() + ",");
        pwr.print("PLEONASTIC,");
        
    //try to get doc feature    
    Integer cnt = (Integer)doc.getFeatures().get("PLEONASM");

    if (null == cnt) {
        cnt = new Integer(0);
    }
    
        pwr.print(cnt);
        pwr.println();

        pwr.close();
        buff.close();
        out.close();
    }     
    catch (Exception ex) {
        Out.prln("Error: " + ex.getMessage());
    }      
}






© 2015 - 2024 Weber Informatics LLC | Privacy Policy