Revision: 19751
          http://sourceforge.net/p/gate/code/19751
Author:   markagreenwood
Date:     2016-11-18 09:04:17 +0000 (Fri, 18 Nov 2016)
Log Message:
-----------
numerous performance fixes and a bit of refactoring

Modified Paths:
--------------
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/configurableexporter/ConfigurableExporter.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexGazMappingTable.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexibleGazetteer.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/NodePosition.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/morph/Morph.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/gui/SyntaxTreeViewer.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/AnnotationDiffExporter.java
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/QualityAssurancePR.java

Added Paths:
-----------
    gate/branches/sawdust2/plugins/Tools/src/main/java/gate/util/
    
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/util/Coordinates.java

Removed Paths:
-------------
    gate/branches/sawdust2/gate-core/src/main/java/gate/util/Coordinates.java

Deleted: 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/Coordinates.java
===================================================================
--- gate/branches/sawdust2/gate-core/src/main/java/gate/util/Coordinates.java   
2016-11-18 09:01:25 UTC (rev 19750)
+++ gate/branches/sawdust2/gate-core/src/main/java/gate/util/Coordinates.java   
2016-11-18 09:04:17 UTC (rev 19751)
@@ -1,67 +0,0 @@
-/*
- *  Coordinates.java
- *
- *  Copyright (c) 1995-2012, The University of Sheffield. See the file
- *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
- *
- *  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).
- * 
- *  Kalina Bontcheva, 20/09/2000
- *
- *  $Id$
- */
-package gate.util;
-
-public class Coordinates {
-
-  int x1, x2, y1, y2;
-
-  public Coordinates(int x1, int y1, int x2, int y2) {
-    this.x1 = x1;
-    this.y1 = y1;
-    this.x2 = x2;
-    this.y2 = y2;
-  }
-
-  public int getX1() {
-    return x1;
-  }
-
-  public int getY1() {
-    return y1;
-  }
-
-  public int getX2() {
-    return x2;
-  }
-
-  public int getY2() {
-    return y2;
-  }
-
-  public void setX1( int x) {
-       x1 = x;
-  }
-
-  public void setX2( int x) {
-       x2 = x;
-  }
-
-  public void setY1( int y) {
-       y1 = y;
-  }
-
-  public void setY2( int y) {
-       y2 = y;
-  }
-
-
-  @Override
-  public String toString() {
-    return "x1=" + x1 + ";y1=" + y1 + ";x2=" + x2 + ";y2=" + y2;
-  }
-  
-} // class Coordinates

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/configurableexporter/ConfigurableExporter.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/configurableexporter/ConfigurableExporter.java
      2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/configurableexporter/ConfigurableExporter.java
      2016-11-18 09:04:17 UTC (rev 19751)
@@ -16,10 +16,15 @@
 
 package gate.configurableexporter;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.util.Iterator;
+import java.util.List;
+
 import gate.Annotation;
 import gate.AnnotationSet;
 import gate.Document;
-import gate.ProcessingResource;
 import gate.Resource;
 import gate.Utils;
 import gate.creole.AbstractLanguageAnalyser;
@@ -30,16 +35,9 @@
 import gate.creole.metadata.Optional;
 import gate.creole.metadata.RunTime;
 
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.util.Iterator;
-import java.util.List;
 
 
 
-
 /**
  *  Configurable Exporter takes a configuration file specifying the
  *  format of the output file. The configuration file consists of a
@@ -75,9 +73,7 @@
  */
 @CreoleResource(name = "Configurable Exporter", 
   comment = "Allows annotations to be exported according to a specified 
format.")
-public class ConfigurableExporter extends AbstractLanguageAnalyser implements
-                                                    ProcessingResource,
-                                                    Serializable {
+public class ConfigurableExporter extends AbstractLanguageAnalyser {
 
   /**
    * 

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexGazMappingTable.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexGazMappingTable.java
   2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexGazMappingTable.java
   2016-11-18 09:04:17 UTC (rev 19751)
@@ -70,9 +70,9 @@
     tempEndOffsets = new long[size];
     
     int i = 0;
-    for (Long key : startMap.keySet()) {
-      tempStartOffsets[i] = key.longValue();
-      tempEndOffsets[i] = startMap.get(key).getTempEndOffset();
+    for (Map.Entry<Long,NodePosition> entry: startMap.entrySet()) {
+      tempStartOffsets[i] = entry.getKey();
+      tempEndOffsets[i] = entry.getValue().getTempEndOffset();
       i++;
     }
     
@@ -149,7 +149,7 @@
       long start = tempStartOffsets[i];
       long end = tempEndOffsets[i];
       NodePosition m = startMap.get(start);
-      System.out.format("FGMT: %d, %d : o(%d, %d) t(%d, %d)\n", start, end,
+      System.out.format("FGMT: %d, %d : o(%d, %d) t(%d, %d)%n", start, end,
           m.getOriginalStartOffset(), m.getOriginalEndOffset(),
           m.getTempStartOffset(), m.getTempEndOffset() );
     }

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexibleGazetteer.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexibleGazetteer.java
     2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/FlexibleGazetteer.java
     2016-11-18 09:04:17 UTC (rev 19751)
@@ -14,13 +14,14 @@
  */
 package gate.creole.gazetteer;
 
+import java.util.List;
+
 import gate.Annotation;
 import gate.AnnotationSet;
 import gate.Document;
 import gate.Factory;
 import gate.FeatureMap;
 import gate.Gate;
-import gate.ProcessingResource;
 import gate.Utils;
 import gate.corpora.DocumentImpl;
 import gate.creole.AbstractLanguageAnalyser;
@@ -32,9 +33,7 @@
 import gate.creole.metadata.RunTime;
 import gate.util.InvalidOffsetException;
 
-import java.util.List;
 
-
 /**
  * <p>
  * Title: Flexible Gazetteer
@@ -57,8 +56,7 @@
  * @version 1.0
  */
 @CreoleResource(name="Flexible Gazetteer", comment="A more flexible list 
lookup component.", helpURL="A more flexible list lookup component.")
-public class FlexibleGazetteer extends AbstractLanguageAnalyser 
-  implements ProcessingResource {
+public class FlexibleGazetteer extends AbstractLanguageAnalyser {
   
   private static final long serialVersionUID = -1023682327651886920L;
   private static final String wrappedOutputASName = "Output";
@@ -120,7 +118,7 @@
         String newTokenValue =
             currentAnnotation.getFeatures().get(keyVal[1]).toString();
         // if no value found for this feature
-        if(newTokenValue == null) continue;
+        //if(newTokenValue == null) continue;
         // feature value found so we need to replace it
         // find the start and end offsets for this token
         long startOffset = Utils.start(currentAnnotation);

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/NodePosition.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/NodePosition.java
  2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/gazetteer/NodePosition.java
  2016-11-18 09:04:17 UTC (rev 19751)
@@ -18,6 +18,7 @@
 
 package gate.creole.gazetteer;
 
+import java.io.Serializable;
 import java.util.Comparator;
 
 /**
@@ -91,8 +92,10 @@
 }
 
 
-class NodePositionComparator implements Comparator<NodePosition> {
+class NodePositionComparator implements Comparator<NodePosition>, Serializable 
{
 
+  private static final long serialVersionUID = -4493343208433034808L;
+
   @Override
   public int compare(NodePosition arg0, NodePosition arg1) {
     long diff = arg0.getTempStartOffset() - arg1.getTempStartOffset();

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/morph/Morph.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/morph/Morph.java 
    2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/creole/morph/Morph.java 
    2016-11-18 09:04:17 UTC (rev 19751)
@@ -30,10 +30,8 @@
 import gate.Factory;
 import gate.Factory.DuplicationContext;
 import gate.FeatureMap;
-import gate.ProcessingResource;
 import gate.Resource;
 import gate.Utils;
-import gate.creole.ANNIEConstants;
 import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.CustomDuplication;
 import gate.creole.ExecutionException;
@@ -53,7 +51,7 @@
         comment = "Morphological Analyzer for the English Language")
 public class Morph
     extends AbstractLanguageAnalyser
-    implements ANNIEConstants, ProcessingResource, CustomDuplication {
+    implements CustomDuplication {
 
   private static final long serialVersionUID = 6964689654685956128L;
 

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/gui/SyntaxTreeViewer.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/gui/SyntaxTreeViewer.java
   2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/gui/SyntaxTreeViewer.java
   2016-11-18 09:04:17 UTC (rev 19751)
@@ -200,8 +200,8 @@
   // is passed
   // as annotations.
   protected Annotation utterance;
-  protected Long utteranceStartOffset = new Long(0);
-  protected Long utteranceEndOffset = new Long(0);
+  protected Long utteranceStartOffset = 0L;
+  protected Long utteranceEndOffset = 0L;
   protected AnnotationSet currentSet = null;
 
   protected String tokenType = ANNIEConstants.TOKEN_ANNOTATION_TYPE;
@@ -642,7 +642,7 @@
           throw new NullPointerException("Can't find leaf node for annotation: 
" + annot);
         }
 
-        JButton button = buttons.get(new Integer(leaf.getID()));
+        JButton button = buttons.get(leaf.getID());
         selection.clear();
         selection.add(button);
 
@@ -651,7 +651,7 @@
         node.add(leaf);
         node.setLevel(1);
         node.setUserObject(annot.getFeatures().get(NODE_CAT_FEATURE_NAME));
-        nonTerminals.put(new Integer(node.getID()), node);
+        nonTerminals.put(node.getID(), node);
         JButton parentButton = createCentralButton(node);
         addLines(node);
 
@@ -703,7 +703,7 @@
     STreeNode parent = createParentNode(
                           (String) 
annot.getFeatures().get(NODE_CAT_FEATURE_NAME),
                           annot);
-    nonTerminals.put(new Integer(parent.getID()), parent);
+    nonTerminals.put(parent.getID(), parent);
     JButton parentButton = createCentralButton(parent);
     addLines(parent);
 
@@ -795,7 +795,7 @@
       node.setLevel(0);
 
       // add to hash table of leaves
-      leaves.put(new Integer(node.getID()), node);
+      leaves.put(node.getID(), node);
 
       // create the corresponding button
       buttonX = createButton4Node(node, buttonX, buttonY);
@@ -898,7 +898,7 @@
     button.setEnabled(true);
 
     this.add(button);
-    buttons.put(new Integer(node.getID()), button);
+    buttons.put(node.getID(), button);
 
     buttonX +=  buttonSize.width + horizButtonGap;
     return buttonX;
@@ -963,7 +963,7 @@
 
     this.add(button);
     // add to hashmap of buttons
-    buttons.put(new Integer(newNode.getID()), button);
+    buttons.put(newNode.getID(), button);
 
     // check if we need to resize the panel
     if (buttonY < 0) {
@@ -1002,7 +1002,7 @@
       // the popup label is set to leaves when the popup has been
       // constructed in showRightClickPopup
       if (popup.getLabel().equals("leaves")) {
-        Integer id = new Integer(e.getActionCommand());
+        Integer id = Integer.valueOf(e.getActionCommand());
 
 //        clearSelection();
         JButton button = buttons.get(id);
@@ -1025,7 +1025,7 @@
                                   treeNodeAnnotationType,
                                   displayedString,
                                   utteranceStartOffset.longValue());
-        nonTerminals.put(new Integer(parent.getID()), parent);
+        nonTerminals.put(parent.getID(), parent);
 
         // create new button positioned centrally above the leaf
         createCentralButton(parent);
@@ -1041,7 +1041,7 @@
       else if (popup.getLabel().equals("non-terminal")) {
         // the action command is set to the id under which
         // the button can be found
-        Integer id = new Integer(e.getActionCommand());
+        Integer id = Integer.valueOf(e.getActionCommand());
 
         //locate button from buttons hashMap and add to selection
         JButton button = buttons.get(id);
@@ -1051,7 +1051,7 @@
         STreeNode parent = createParentNode(menuItem.getText());
 
         //add to nonTerminals HashMap
-        nonTerminals.put(new Integer(parent.getID()), parent);
+        nonTerminals.put(parent.getID(), parent);
 
         //create new button positioned centrally above the leaf
         createCentralButton(parent);
@@ -1125,7 +1125,7 @@
 
     //that'll always work coz we checked it in MouseClicked.
     JButton source = (JButton) e.getSource();
-    Integer id = new Integer(source.getActionCommand());
+    Integer id = Integer.valueOf(source.getActionCommand());
 
     //check if it's a leaf and if so, offer the leaf annotation dialog
     Object obj = leaves.get(id);
@@ -1173,7 +1173,7 @@
 
   private void addLines(STreeNode newNode) {
 
-    JButton newButton = buttons.get(new Integer(newNode.getID()));
+    JButton newButton = buttons.get(newNode.getID());
     int nbX = newButton.getX() + newButton.getWidth()/2;
     int nbY = newButton.getY() + newButton.getHeight();
 
@@ -1260,7 +1260,7 @@
     long begin =  2147483647, end = 0, level= -1;
     for (Iterator<JButton> i = selection.iterator(); i.hasNext(); ) {
       JButton button = i.next();
-      Integer id = new Integer(button.getActionCommand());
+      Integer id = Integer.valueOf(button.getActionCommand());
 
       STreeNode child = nonTerminals.get(id);
 
@@ -1297,7 +1297,7 @@
     long level = -1;
     for (Iterator<JButton> i = selection.iterator(); i.hasNext(); ) {
       JButton button = i.next();
-      Integer id = new Integer(button.getActionCommand());
+      Integer id = Integer.valueOf(button.getActionCommand());
 
       STreeNode child = nonTerminals.get(id);
 
@@ -1328,7 +1328,7 @@
   // remove that node from the syntax tree
   void removeNode(JButton button) {
 
-    Integer id = new Integer(button.getActionCommand());
+    Integer id = Integer.valueOf(button.getActionCommand());
     STreeNode node = nonTerminals.get(id);
     nonTerminals.remove(id);
     node.removeAnnotation(document);
@@ -1362,7 +1362,7 @@
     STreeNode parent = (STreeNode) node.getParent();
 
     while (parent != null) {
-      Integer id = new Integer(parent.getID());
+      Integer id = parent.getID();
       parent.removeAnnotation(document);
       if (parent.isNodeChild(node))
         parent.remove(node);
@@ -1390,7 +1390,7 @@
     * recalculates all lines from that node to all its children
     */
   private void recalculateLines(STreeNode node) {
-    Integer id = new Integer(node.getID());
+    Integer id = node.getID();
     JButton button = buttons.get(id);
 
     int bX = button.getX() + button.getWidth()/2;
@@ -1398,7 +1398,7 @@
 
     for (Enumeration<?> e = node.children(); e.hasMoreElements(); ) {
       STreeNode subNode = (STreeNode) e.nextElement();
-      Integer sid = new Integer(subNode.getID());
+      Integer sid = subNode.getID();
       JButton subButton = buttons.get(sid);
 
       Coordinates coords = new Coordinates(

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/AnnotationDiffExporter.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/AnnotationDiffExporter.java
      2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/AnnotationDiffExporter.java
      2016-11-18 09:04:17 UTC (rev 19751)
@@ -76,95 +76,97 @@
     String docName = document.getName();
 
     String nl = Strings.getNl();
-    Writer fw = new BufferedWriter(new FileWriter(destinationFile));
+    try (Writer fw = new BufferedWriter(new FileWriter(destinationFile));) {
 
-    // write the header
-    fw.write("<html><body>");
-
-    // some metadata info (i.e. document name, annotation sets used for
-    // diff
-    // calculations etc.
-    fw.write("<H2>Annotation Diff - comparing annotations! </H2>");
-    fw.write("<TABLE cellpadding=\"5\" border=\"0\"");
-    fw.write(nl);
-    fw.write("<TR>" + nl);
-    fw.write("\t<TH align=\"left\">&nbsp;</TH>" + nl);
-    fw.write("\t<TH align=\"left\">Document</TH>" + nl);
-    fw.write("\t<TH align=\"left\">Annotation Set</TH>" + nl);
-    fw.write("</TR>" + nl);
-
-    fw.write("<TR>" + nl);
-    fw.write("\t<TH align=\"left\">Key</TH>" + nl);
-    fw.write("\t<TD align=\"left\">" + docName + "</TD>" + nl);
-    fw.write("\t<TD align=\"left\">" + keySetName + "</TD>" + nl);
-    fw.write("</TR>" + nl);
-    fw.write("<TR>" + nl);
-    fw.write("\t<TH align=\"left\">Response</TH>" + nl);
-    fw.write("\t<TD align=\"left\">" + docName + "</TD>" + nl);
-    fw.write("\t<TD align=\"left\">" + respSetName + "</TD>" + nl);
-    fw.write("</TR>" + nl);
-    fw.write("</TABLE>" + nl);
-    fw.write("<BR><BR><BR>" + nl);
-    fw.write("<HR/>");
-
-    // one differ output at a time
-    for(AnnotationDiffer differ : differs.keySet()) {
-
-      // results of the differ
-      List<AnnotationDiffer.Pairing> pairings = differs.get(differ);
-
-      // using DiffTable class (copied from AnnotationDifferGUI) with
-      // minor
-      // changes to produce almost identical presentation as produced by
-      // the
-      // annotation diff tool
-      DiffTable diffTable = new DiffTable(pairings);
-
-      // mention of the relevant annotation type
-      fw.write("<H2>" + differ.getAnnotationType() + " annotations" + "</H2>");
-
-      // write the results
-      java.text.NumberFormat format = java.text.NumberFormat.getInstance();
-      format.setMaximumFractionDigits(4);
-      fw.write("Recall: " + format.format(differ.getRecallStrict()) + "<br>"
-              + nl);
-      fw.write("Precision: " + format.format(differ.getPrecisionStrict())
-              + "<br>" + nl);
-      fw.write("F-measure: " + format.format(differ.getFMeasureStrict(1))
-              + "<br>" + nl);
-      fw.write("<br>");
-      fw.write("Correct: " + differ.getCorrectMatches() + "<br>" + nl);
-      fw.write("Partially correct: " + differ.getPartiallyCorrectMatches()
-              + "<br>" + nl);
-      fw.write("Missing: " + differ.getMissing() + "<br>" + nl);
-      fw.write("False positives: " + differ.getSpurious() + "<br>" + nl);
-
-      // a table containing comparison of annotations
-      fw.write("<table cellpadding=\"0\" border=\"1\">" + nl + "<TR>" + nl);
-
-      int maxColIdx = diffTable.getColumnCount() - 1;
-      for(int col = 0; col <= maxColIdx; col++) {
-        fw.write("\t<TH align=\"left\">" + diffTable.getColumnName(col)
-                + "</TH>" + nl);
-      }
-      fw.write("</TR>");
-      int rowCnt = diffTable.getRowCount();
-      for(int row = 0; row < rowCnt; row++) {
-        fw.write("<TR>");
+      // write the header
+      fw.write("<html><body>");
+  
+      // some metadata info (i.e. document name, annotation sets used for
+      // diff
+      // calculations etc.
+      fw.write("<H2>Annotation Diff - comparing annotations! </H2>");
+      fw.write("<TABLE cellpadding=\"5\" border=\"0\"");
+      fw.write(nl);
+      fw.write("<TR>" + nl);
+      fw.write("\t<TH align=\"left\">&nbsp;</TH>" + nl);
+      fw.write("\t<TH align=\"left\">Document</TH>" + nl);
+      fw.write("\t<TH align=\"left\">Annotation Set</TH>" + nl);
+      fw.write("</TR>" + nl);
+  
+      fw.write("<TR>" + nl);
+      fw.write("\t<TH align=\"left\">Key</TH>" + nl);
+      fw.write("\t<TD align=\"left\">" + docName + "</TD>" + nl);
+      fw.write("\t<TD align=\"left\">" + keySetName + "</TD>" + nl);
+      fw.write("</TR>" + nl);
+      fw.write("<TR>" + nl);
+      fw.write("\t<TH align=\"left\">Response</TH>" + nl);
+      fw.write("\t<TD align=\"left\">" + docName + "</TD>" + nl);
+      fw.write("\t<TD align=\"left\">" + respSetName + "</TD>" + nl);
+      fw.write("</TR>" + nl);
+      fw.write("</TABLE>" + nl);
+      fw.write("<BR><BR><BR>" + nl);
+      fw.write("<HR/>");
+  
+      // one differ output at a time
+      for(Map.Entry<AnnotationDiffer,List<AnnotationDiffer.Pairing>> entry : 
differs.entrySet()) {
+  
+        AnnotationDiffer differ = entry.getKey();
+        
+        // results of the differ
+        List<AnnotationDiffer.Pairing> pairings = entry.getValue();
+  
+        // using DiffTable class (copied from AnnotationDifferGUI) with
+        // minor
+        // changes to produce almost identical presentation as produced by
+        // the
+        // annotation diff tool
+        DiffTable diffTable = new DiffTable(pairings);
+  
+        // mention of the relevant annotation type
+        fw.write("<H2>" + differ.getAnnotationType() + " annotations" + 
"</H2>");
+  
+        // write the results
+        java.text.NumberFormat format = java.text.NumberFormat.getInstance();
+        format.setMaximumFractionDigits(4);
+        fw.write("Recall: " + format.format(differ.getRecallStrict()) + "<br>"
+                + nl);
+        fw.write("Precision: " + format.format(differ.getPrecisionStrict())
+                + "<br>" + nl);
+        fw.write("F-measure: " + format.format(differ.getFMeasureStrict(1))
+                + "<br>" + nl);
+        fw.write("<br>");
+        fw.write("Correct: " + differ.getCorrectMatches() + "<br>" + nl);
+        fw.write("Partially correct: " + differ.getPartiallyCorrectMatches()
+                + "<br>" + nl);
+        fw.write("Missing: " + differ.getMissing() + "<br>" + nl);
+        fw.write("False positives: " + differ.getSpurious() + "<br>" + nl);
+  
+        // a table containing comparison of annotations
+        fw.write("<table cellpadding=\"0\" border=\"1\">" + nl + "<TR>" + nl);
+  
+        int maxColIdx = diffTable.getColumnCount() - 1;
         for(int col = 0; col <= maxColIdx; col++) {
-          Color bgCol = diffTable.getBackgroundAt(row, col);
-          fw.write("\t<TD bgcolor=\"#"
-                  + Integer.toHexString(bgCol.getRGB()).substring(2) + "\">"
-                  + diffTable.getValueAt(row, col) + "</TD>" + nl);
+          fw.write("\t<TH align=\"left\">" + diffTable.getColumnName(col)
+                  + "</TH>" + nl);
         }
         fw.write("</TR>");
+        int rowCnt = diffTable.getRowCount();
+        for(int row = 0; row < rowCnt; row++) {
+          fw.write("<TR>");
+          for(int col = 0; col <= maxColIdx; col++) {
+            Color bgCol = diffTable.getBackgroundAt(row, col);
+            fw.write("\t<TD bgcolor=\"#"
+                    + Integer.toHexString(bgCol.getRGB()).substring(2) + "\">"
+                    + diffTable.getValueAt(row, col) + "</TD>" + nl);
+          }
+          fw.write("</TR>");
+        }
+        fw.write("</table><br><br>");
+        fw.write("<HR/>");
       }
-      fw.write("</table><br><br>");
-      fw.write("<HR/>");
+      fw.write("</body></html>");
+      fw.flush();
     }
-    fw.write("</body></html>");
-    fw.flush();
-    fw.close();
 
   }
 

Modified: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/QualityAssurancePR.java
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/QualityAssurancePR.java
  2016-11-18 09:01:25 UTC (rev 19750)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/qa/QualityAssurancePR.java
  2016-11-18 09:04:17 UTC (rev 19751)
@@ -1,20 +1,5 @@
 package gate.qa;
 
-import gate.AnnotationSet;
-import gate.Document;
-import gate.Factory;
-import gate.ProcessingResource;
-import gate.Resource;
-import gate.creole.AbstractLanguageAnalyser;
-import gate.creole.ExecutionException;
-import gate.creole.ResourceInstantiationException;
-import gate.creole.metadata.CreoleParameter;
-import gate.creole.metadata.CreoleResource;
-import gate.creole.metadata.Optional;
-import gate.creole.metadata.RunTime;
-import gate.creole.ontology.InvalidURIException;
-import gate.util.AnnotationDiffer;
-
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
@@ -30,6 +15,20 @@
 import java.util.Map;
 import java.util.Set;
 
+import gate.AnnotationSet;
+import gate.Document;
+import gate.Factory;
+import gate.Resource;
+import gate.creole.AbstractLanguageAnalyser;
+import gate.creole.ExecutionException;
+import gate.creole.ResourceInstantiationException;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
+import gate.creole.metadata.RunTime;
+import gate.creole.ontology.InvalidURIException;
+import gate.util.AnnotationDiffer;
+
 /**
  * This PR has the same functionality as the Quality Assurance GUI. If
  * added to a corpus pipeline, it executes on the very last document -
@@ -47,8 +46,7 @@
  */
 @CreoleResource(name = "Quality Assurance PR", comment = "The Quality 
Assurance PR provides a functionality of"
         + " the Corpus QA Tool in GATE Developer")
-public class QualityAssurancePR extends AbstractLanguageAnalyser implements
-                                                                
ProcessingResource {
+public class QualityAssurancePR extends AbstractLanguageAnalyser {
 
   private static final long serialVersionUID = 806633306890012316L;
 

Copied: 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/util/Coordinates.java 
(from rev 19750, 
gate/branches/sawdust2/gate-core/src/main/java/gate/util/Coordinates.java)
===================================================================
--- 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/util/Coordinates.java   
                            (rev 0)
+++ 
gate/branches/sawdust2/plugins/Tools/src/main/java/gate/util/Coordinates.java   
    2016-11-18 09:04:17 UTC (rev 19751)
@@ -0,0 +1,71 @@
+/*
+ *  Coordinates.java
+ *
+ *  Copyright (c) 1995-2012, The University of Sheffield. See the file
+ *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ *  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).
+ * 
+ *  Kalina Bontcheva, 20/09/2000
+ *
+ *  $Id$
+ */
+package gate.util;
+
+import java.io.Serializable;
+
+public class Coordinates implements Serializable {
+
+  private static final long serialVersionUID = -806496667521685578L;
+
+  int x1, x2, y1, y2;
+
+  public Coordinates(int x1, int y1, int x2, int y2) {
+    this.x1 = x1;
+    this.y1 = y1;
+    this.x2 = x2;
+    this.y2 = y2;
+  }
+
+  public int getX1() {
+    return x1;
+  }
+
+  public int getY1() {
+    return y1;
+  }
+
+  public int getX2() {
+    return x2;
+  }
+
+  public int getY2() {
+    return y2;
+  }
+
+  public void setX1( int x) {
+       x1 = x;
+  }
+
+  public void setX2( int x) {
+       x2 = x;
+  }
+
+  public void setY1( int y) {
+       y1 = y;
+  }
+
+  public void setY2( int y) {
+       y2 = y;
+  }
+
+
+  @Override
+  public String toString() {
+    return "x1=" + x1 + ";y1=" + y1 + ";x2=" + x2 + ";y2=" + y2;
+  }
+  
+} // class Coordinates

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to