Revision: 19742
          http://sourceforge.net/p/gate/code/19742
Author:   markagreenwood
Date:     2016-11-16 17:58:23 +0000 (Wed, 16 Nov 2016)
Log Message:
-----------
lots of bug fixes and performance enhancements

Modified Paths:
--------------
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/POSTagger.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/Coreferencer.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/NominalCoref.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/PronominalCoref.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/AbstractGazetteer.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/DefaultGazetteer.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/RegexSentenceSplitter.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/SentenceSplitter.java
    
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/tokeniser/DefaultTokeniser.java

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/POSTagger.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/POSTagger.java   
    2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/POSTagger.java   
    2016-11-16 17:58:23 UTC (rev 19742)
@@ -43,7 +43,7 @@
 @CreoleResource(name = "ANNIE POS Tagger",
         helpURL = "http://gate.ac.uk/userguide/sec:annie:tagger";,
         comment = "Mark Hepple's Brill-style POS tagger", icon="pos-tagger")
-public class POSTagger extends AbstractLanguageAnalyser implements 
ANNIEConstants {
+public class POSTagger extends AbstractLanguageAnalyser {
 
   private static final long serialVersionUID = 7680938864165071808L;
 

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/Coreferencer.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/Coreferencer.java
      2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/Coreferencer.java
      2016-11-16 17:58:23 UTC (rev 19742)
@@ -30,7 +30,6 @@
 import gate.Factory;
 import gate.FeatureMap;
 import gate.Resource;
-import gate.creole.ANNIEConstants;
 import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
@@ -42,7 +41,7 @@
 import gate.util.SimpleFeatureMapImpl;
 
 @CreoleResource(name="ANNIE Pronominal Coreferencer", comment="Pronominal 
Coreference resolution component.", 
helpURL="http://gate.ac.uk/userguide/sec:annie:pronom-coref";, 
icon="pronominal-coreferencer")
-public class Coreferencer extends AbstractLanguageAnalyser implements 
ANNIEConstants {
+public class Coreferencer extends AbstractLanguageAnalyser {
 
   private static final long serialVersionUID = -2343178168872843239L;
 

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/NominalCoref.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/NominalCoref.java
      2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/NominalCoref.java
      2016-11-16 17:58:23 UTC (rev 19742)
@@ -26,7 +26,6 @@
 import gate.Document;
 import gate.FeatureMap;
 import gate.Resource;
-import gate.creole.ANNIEConstants;
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
 import gate.creole.metadata.CreoleParameter;
@@ -38,8 +37,7 @@
 import gate.util.SimpleFeatureMapImpl;
 
 @CreoleResource(name="ANNIE Nominal Coreferencer", comment="Nominal 
Coreference resolution component", 
helpURL="http://gate.ac.uk/userguide/sec:annie:pronom-coref";, 
icon="nominal-coreferencer")
-public class NominalCoref extends AbstractCoreferencer
-    implements ANNIEConstants {
+public class NominalCoref extends AbstractCoreferencer {
 
   private static final long serialVersionUID = 1497388811557744017L;
 

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/PronominalCoref.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/PronominalCoref.java
   2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/coref/PronominalCoref.java
   2016-11-16 17:58:23 UTC (rev 19742)
@@ -16,6 +16,18 @@
 
 package gate.creole.coref;
 
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import gate.Annotation;
 import gate.AnnotationSet;
 import gate.Document;
@@ -25,7 +37,6 @@
 import gate.LanguageAnalyser;
 import gate.Node;
 import gate.Resource;
-import gate.creole.ANNIEConstants;
 import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
@@ -36,21 +47,9 @@
 import gate.util.Err;
 import gate.util.SimpleFeatureMapImpl;
 
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 @CreoleResource(isPrivate = true)
 public class PronominalCoref extends AbstractLanguageAnalyser
-                              implements ANNIEConstants,
-                              Benchmarkable {
+                              implements Benchmarkable {
 
   private static final long serialVersionUID = 3860815557386683264L;
 
@@ -108,9 +107,9 @@
   /** --- */
   private AnnotationSet defaultAnnotations;
   /** --- */
-  private Sentence[] textSentences;
+  private transient Sentence[] textSentences;
   /** --- */
-  private Quote[] quotedText;
+  private transient Quote[] quotedText;
   /** --- */
   private Annotation[] pleonasticIt;
   /** --- */
@@ -220,7 +219,7 @@
 
   /** --- */
   public Boolean getResolveIt() {
-    return new Boolean(this.resolveIt);
+    return resolveIt;
   }
 
 
@@ -280,9 +279,10 @@
     Arrays.sort(arrPronouns,ANNOTATION_OFFSET_COMPARATOR);
 
     //8.cleanup - ease the GC
-    pronouns = null;
-    personalPronouns = null;
-    possesivePronouns = null;
+    //as of JDK6 this is no longer helpful
+    //pronouns = null;
+    //personalPronouns = null;
+    //possesivePronouns = null;
 
     int prnSentIndex = 0;
 
@@ -854,8 +854,10 @@
   }
 
   @SuppressWarnings("rawtypes")
-  private static class AnnotationOffsetComparator implements Comparator {
+  private static class AnnotationOffsetComparator implements Comparator, 
Serializable {
 
+    private static final long serialVersionUID = 4529121506801473785L;
+
     private int _getOffset(Object o) {
 
       if (o instanceof Annotation) {

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/AbstractGazetteer.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/AbstractGazetteer.java
     2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/AbstractGazetteer.java
     2016-11-16 17:58:23 UTC (rev 19742)
@@ -51,13 +51,13 @@
   /**
    * Should this gazetteer be case sensitive. The default value is true.
    */
-  protected Boolean caseSensitive = new Boolean(true);
+  protected Boolean caseSensitive;
 
   /**
    * Should this gazetteer only match whole words. The default value is
    * <tt>true</tt>.
    */
-  protected Boolean wholeWordsOnly = new Boolean(true);
+  protected Boolean wholeWordsOnly;
 
   /**
    * Should this gazetteer only match the longest string starting from any 
@@ -69,7 +69,7 @@
    * behaviour since version 2.0. Setting this parameter to <tt>false</tt> 
will 
    * cause the gazetteer to match all possible prefixes.
    */
-  protected Boolean longestMatchOnly = new Boolean(true);
+  protected Boolean longestMatchOnly;
   
   /** the linear definition of the gazetteer */
   protected LinearDefinition definition;

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/DefaultGazetteer.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/DefaultGazetteer.java
      2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/gazetteer/DefaultGazetteer.java
      2016-11-16 17:58:23 UTC (rev 19742)
@@ -29,7 +29,6 @@
 import gate.FeatureMap;
 import gate.Resource;
 import gate.Utils;
-import gate.creole.ANNIEConstants;
 import gate.creole.CustomDuplication;
 import gate.creole.ExecutionException;
 import gate.creole.ExecutionInterruptedException;
@@ -66,7 +65,7 @@
  */
 @CreoleResource(name="ANNIE Gazetteer", comment="A list lookup component.", 
icon="gazetteer", helpURL="http://gate.ac.uk/userguide/sec:annie:gazetteer";)
 public class DefaultGazetteer extends AbstractGazetteer
-                              implements CustomDuplication, ANNIEConstants {
+                              implements CustomDuplication {
 
   private static final long serialVersionUID = -8976141132455436099L;
 
@@ -439,8 +438,8 @@
 //                          LOOKUP_ANNOTATION_TYPE,
 //                          fm);
 //        }else{
-          annotationSet.add(new Long(matchedRegionStart),
-                          new Long(matchedRegionEnd + 1),
+          annotationSet.add(matchedRegionStart,
+                          matchedRegionEnd + 1,
                           currentLookup.annotationType, //this pojo attribute 
will have Lookup as a default tag.
                           fm);
        // }

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/RegexSentenceSplitter.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/RegexSentenceSplitter.java
  2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/RegexSentenceSplitter.java
  2016-11-16 17:58:23 UTC (rev 19742)
@@ -211,7 +211,7 @@
             //add the split annotation
             FeatureMap features = Factory.newFeatureMap();
             features.put("kind", "internal");
-            outputAS.add(new Long(nextMatch.start()), new 
Long(nextMatch.end()),
+            outputAS.add(Long.valueOf(nextMatch.start()), 
Long.valueOf(nextMatch.end()),
                     "Split", features);
             //generate the sentence annotation
             int endOffset = nextMatch.end();
@@ -225,7 +225,7 @@
             //if there is any useful text between the two offsets, generate
             //a new sentence
             if(lastSentenceEnd < nextMatch.start()){
-              outputAS.add(new Long(lastSentenceEnd), new Long(endOffset),
+              outputAS.add(Long.valueOf(lastSentenceEnd), 
Long.valueOf(endOffset),
                       ANNIEConstants.SENTENCE_ANNOTATION_TYPE,
                       Factory.newFeatureMap());
             }
@@ -251,7 +251,7 @@
             //generate the split
             FeatureMap features = Factory.newFeatureMap();
             features.put("kind", "external");
-            outputAS.add(new Long(nextMatch.start()), new 
Long(nextMatch.end()),
+            outputAS.add(Long.valueOf(nextMatch.start()), 
Long.valueOf(nextMatch.end()),
                     "Split", features);
             //generate the sentence annotation
             //find the last non whitespace character, going backward from
@@ -272,7 +272,7 @@
             //if there is any useful text between the two offsets, generate
             //a new sentence
             if(lastSentenceEnd < endOffset){
-              outputAS.add(new Long(lastSentenceEnd), new Long(endOffset),
+              outputAS.add(Long.valueOf(lastSentenceEnd), 
Long.valueOf(endOffset),
                       ANNIEConstants.SENTENCE_ANNOTATION_TYPE,
                       Factory.newFeatureMap());
             }

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/SentenceSplitter.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/SentenceSplitter.java
       2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/splitter/SentenceSplitter.java
       2016-11-16 17:58:23 UTC (rev 19742)
@@ -19,7 +19,6 @@
 import gate.FeatureMap;
 import gate.Gate;
 import gate.Resource;
-import gate.creole.ANNIEConstants;
 import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.ExecutionException;
 import gate.creole.ExecutionInterruptedException;
@@ -45,7 +44,7 @@
  * results in a usable form.
  */
 @CreoleResource(name="ANNIE Sentence Splitter", comment="ANNIE sentence 
splitter.", helpURL="http://gate.ac.uk/userguide/sec:annie:splitter";, 
icon="sentence-splitter")
-public class SentenceSplitter extends AbstractLanguageAnalyser implements 
Benchmarkable, ANNIEConstants {
+public class SentenceSplitter extends AbstractLanguageAnalyser implements 
Benchmarkable {
 
   private static final long serialVersionUID = -5335682060379173111L;
 
@@ -162,7 +161,7 @@
       gazetteer.addStatusListener(sListener);
       gazetteer.execute();
 
-    } catch(Exception e) {
+    } catch(ResourceInstantiationException e) {
       throw new ExecutionException(e);
     } finally {
       gazetteer.setDocument(null);
@@ -190,7 +189,7 @@
               Benchmark.createBenchmarkId("SentenceSplitterTransducer",
                       getBenchmarkId()), this, null);
 
-    } catch(Exception e) {
+    } catch(ResourceInstantiationException e) {
       throw new ExecutionException(e);
     } finally {
       transducer.setDocument(null);
@@ -217,7 +216,7 @@
     if(sentences == null || sentences.isEmpty()){
       //create an annotation covering the entire content
       try{
-        outputAS.add(new Long(0), document.getContent().size(), 
+        outputAS.add(0L, document.getContent().size(), 
                 SENTENCE_ANNOTATION_TYPE, Factory.newFeatureMap());
       }catch(InvalidOffsetException ioe){
         throw new GateRuntimeException(ioe);

Modified: 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/tokeniser/DefaultTokeniser.java
===================================================================
--- 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/tokeniser/DefaultTokeniser.java
      2016-11-16 17:57:52 UTC (rev 19741)
+++ 
gate/branches/sawdust2/plugins/ANNIE/src/main/java/gate/creole/tokeniser/DefaultTokeniser.java
      2016-11-16 17:58:23 UTC (rev 19742)
@@ -154,7 +154,7 @@
               Benchmark.createBenchmarkId("simpleTokeniser", getBenchmarkId()),
               this, null);
 
-    } catch(Exception e) {
+    } catch(ResourceInstantiationException e) {
       throw new ExecutionException("The execution of the \"" + getName()
               + "\" tokeniser has been abruptly interrupted!", e);
     } finally {
@@ -183,7 +183,7 @@
               Benchmark.createBenchmarkId("transducer", getBenchmarkId()),
               this, null);
 
-    } catch(Exception e) {
+    } catch(ResourceInstantiationException e) {
       throw new ExecutionException("The execution of the \"" + getName()
               + "\" tokeniser has been abruptly interrupted!", e);
     } finally {

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