Revision: 16262
http://gate.svn.sourceforge.net/gate/?rev=16262&view=rev
Author: adamfunk
Date: 2012-11-13 14:29:47 +0000 (Tue, 13 Nov 2012)
Log Message:
-----------
Better messages; stuff at the bottom of the GATE GUI. Minor tweaks
like catching the interrupts.
Placeholders for Dutch (with NER config file) and German (no models
checked in for either).
Modified Paths:
--------------
gate/trunk/plugins/OpenNLP/README
gate/trunk/plugins/OpenNLP/resources/opennlp.gapp
gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNLPNameFin.java
gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpChunker.java
gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpPOS.java
gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpSentenceSplit.java
gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpTokenizer.java
Added Paths:
-----------
gate/trunk/plugins/OpenNLP/models/dutch/
gate/trunk/plugins/OpenNLP/models/dutch/nl-ner.conf
gate/trunk/plugins/OpenNLP/models/german/
gate/trunk/plugins/OpenNLP/resources/opennlp-de.gapp
gate/trunk/plugins/OpenNLP/resources/opennlp-nl.gapp
Modified: gate/trunk/plugins/OpenNLP/README
===================================================================
--- gate/trunk/plugins/OpenNLP/README 2012-11-13 13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/README 2012-11-13 14:29:47 UTC (rev 16262)
@@ -5,22 +5,19 @@
The wrappers use the following libraries:
-OpenNLP Java API from http://opennlp.sourceforge.net/
-OpenNLP Tools from http://opennlp.sourceforge.net/
-OpenNLP Maxent from http://maxent.sourceforge.net/
-GNU Trove from http://trove4j.sourceforge.net/
+OpenNLP Tools from <https://opennlp.apache.org/>
+OpenNLP Maxent from <https://opennlp.apache.org/>
All of the above libraries are redistributed here under the GNU Lesser
General Public License (LGPL) Version 2.1, a copy of which can be
found in the file LICENSE.
By default, the wrappers use models for English which can be found in
-models/english directory. The models are copies of those in the "models"
-module in the OpenNLP CVS repository at http://opennlp.cvs.sourceforge.net
-These models have also been redistributed here under the GNU Lesser General
-Public License (LGPL) Version 2.1, a copy of which can be found in the file
-LICENSE.
+models/english directory. The models are copies of those available at
+<http://opennlp.sourceforge.net/models-1.5/>. These models have also
+been redistributed here under the GNU Lesser General Public License
+(LGPL) Version 2.1, a copy of which can be found in the file LICENSE.
-Thanks are due to Georgi D. Georgiev of Ontotext for wrapping the
-OpenNLP tools for GATE, and to the OpenNLP project.
+Thanks are due to Georgi D. Georgiev of Ontotext for originally
+wrapping the OpenNLP tools for GATE, and to the OpenNLP project.
Property changes on: gate/trunk/plugins/OpenNLP/models/dutch
___________________________________________________________________
Added: svn:ignore
+ *.bin
Copied: gate/trunk/plugins/OpenNLP/models/dutch/nl-ner.conf (from rev 16261,
gate/trunk/plugins/OpenNLP/models/english/en-ner.conf)
===================================================================
--- gate/trunk/plugins/OpenNLP/models/dutch/nl-ner.conf
(rev 0)
+++ gate/trunk/plugins/OpenNLP/models/dutch/nl-ner.conf 2012-11-13 14:29:47 UTC
(rev 16262)
@@ -0,0 +1,4 @@
+nl-ner-location.bin Location
+nl-ner-organization.bin Organization
+nl-ner-person.bin Person
+nl-ner-misc.bin Misc
Property changes on: gate/trunk/plugins/OpenNLP/models/german
___________________________________________________________________
Added: svn:ignore
+ *.bin
Added: gate/trunk/plugins/OpenNLP/resources/opennlp-de.gapp
===================================================================
--- gate/trunk/plugins/OpenNLP/resources/opennlp-de.gapp
(rev 0)
+++ gate/trunk/plugins/OpenNLP/resources/opennlp-de.gapp 2012-11-13
14:29:47 UTC (rev 16262)
@@ -0,0 +1,215 @@
+<gate.util.persistence.GateApplication>
+ <urlList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../../OpenNLP/</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../../ANNIE/</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </urlList>
+ <application
class="gate.util.persistence.ConditionalSerialAnalyserControllerPersistence">
+ <strategiesList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.PRPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>setsToKeep</string>
+ <gate.util.persistence.CollectionPersistence>
+ <localList>
+ <string>Key</string>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </gate.util.persistence.CollectionPersistence>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>annotationTypes</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>setsToRemove</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>keepOriginalMarkupsAS</string>
+ <boolean>true</boolean>
+ </entry>
+ </localMap>
+ </runtimeParams>
+
<resourceType>gate.creole.annotdelete.AnnotationDeletePR</resourceType>
+ <resourceName>DocReset</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>annotationSetName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpTokenizer</resourceType>
+ <resourceName>OpenNLP_DE_Tokenizer</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+
<urlString>$relpath$../models/german/de-token.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>annotationSetName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpSentenceSplit</resourceType>
+ <resourceName>OpenNLP_DE_Sentence</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+
<urlString>$relpath$../models/german/de-sent.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>outputASName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>inputASName</string>
+ <string></string>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpPOS</resourceType>
+ <resourceName>OpenNLP_DE_POS</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+
<urlString>$relpath$../models/german/de-pos-maxent.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </strategiesList>
+ <prList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.PRPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[2]/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[3]/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[4]/pr"/>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </prList>
+
<resourceType>gate.creole.ConditionalSerialAnalyserController</resourceType>
+ <resourceName>OpenNLP German</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </application>
+</gate.util.persistence.GateApplication>
\ No newline at end of file
Property changes on: gate/trunk/plugins/OpenNLP/resources/opennlp-de.gapp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: gate/trunk/plugins/OpenNLP/resources/opennlp-nl.gapp
===================================================================
--- gate/trunk/plugins/OpenNLP/resources/opennlp-nl.gapp
(rev 0)
+++ gate/trunk/plugins/OpenNLP/resources/opennlp-nl.gapp 2012-11-13
14:29:47 UTC (rev 16262)
@@ -0,0 +1,263 @@
+<gate.util.persistence.GateApplication>
+ <urlList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../../OpenNLP/</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../../ANNIE/</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </urlList>
+ <application
class="gate.util.persistence.ConditionalSerialAnalyserControllerPersistence">
+ <strategiesList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.PRPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>setsToKeep</string>
+ <gate.util.persistence.CollectionPersistence>
+ <localList>
+ <string>Key</string>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </gate.util.persistence.CollectionPersistence>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>annotationTypes</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>setsToRemove</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>keepOriginalMarkupsAS</string>
+ <boolean>true</boolean>
+ </entry>
+ </localMap>
+ </runtimeParams>
+
<resourceType>gate.creole.annotdelete.AnnotationDeletePR</resourceType>
+ <resourceName>Document_Reset</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>annotationSetName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpTokenizer</resourceType>
+ <resourceName>OpenNLP_NL_Tokenizer</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+
<urlString>$relpath$../models/dutch/nl-token.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>annotationSetName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpSentenceSplit</resourceType>
+ <resourceName>OpenNLP_NL_Sentence</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../models/dutch/nl-sent.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>outputASName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>inputASName</string>
+ <string></string>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNlpPOS</resourceType>
+ <resourceName>OpenNLP_NL_POS</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>model</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+
<urlString>$relpath$../models/dutch/nl-pos-maxent.bin</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <gate.util.persistence.AnalyserRunningStrategyPersistence>
+ <runMode>1</runMode>
+ <featureName></featureName>
+ <featureValue></featureValue>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>outputASName</string>
+ <string></string>
+ </entry>
+ <entry>
+ <string>document</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>corpus</string>
+ <null/>
+ </entry>
+ <entry>
+ <string>inputASName</string>
+ <string></string>
+ </entry>
+ </localMap>
+ </runtimeParams>
+ <resourceType>gate.opennlp.OpenNLPNameFin</resourceType>
+ <resourceName>OpenNLP_NL_NER</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>config</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../models/dutch/nl-ner.conf</urlString>
+ </gate.util.persistence.PersistenceManager-URLHolder>
+ </entry>
+ </localMap>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </pr>
+ </gate.util.persistence.AnalyserRunningStrategyPersistence>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </strategiesList>
+ <prList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.PRPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[2]/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[3]/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[4]/pr"/>
+ <gate.util.persistence.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence[5]/pr"/>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </prList>
+
<resourceType>gate.creole.ConditionalSerialAnalyserController</resourceType>
+ <resourceName>OpenNLP Dutch</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </initParams>
+ <features class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </features>
+ </application>
+</gate.util.persistence.GateApplication>
\ No newline at end of file
Property changes on: gate/trunk/plugins/OpenNLP/resources/opennlp-nl.gapp
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: gate/trunk/plugins/OpenNLP/resources/opennlp.gapp
===================================================================
--- gate/trunk/plugins/OpenNLP/resources/opennlp.gapp 2012-11-13 13:37:58 UTC
(rev 16261)
+++ gate/trunk/plugins/OpenNLP/resources/opennlp.gapp 2012-11-13 14:29:47 UTC
(rev 16262)
@@ -294,7 +294,7 @@
<collectionType>java.util.ArrayList</collectionType>
</prList>
<resourceType>gate.creole.ConditionalSerialAnalyserController</resourceType>
- <resourceName>OpenNLP Pipeline</resourceName>
+ <resourceName>OpenNLP English</resourceName>
<initParams class="gate.util.persistence.MapPersistence">
<mapType>gate.util.SimpleFeatureMapImpl</mapType>
<localMap/>
Modified: gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNLPNameFin.java
===================================================================
--- gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNLPNameFin.java
2012-11-13 13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNLPNameFin.java
2012-11-13 14:29:47 UTC (rev 16262)
@@ -13,6 +13,7 @@
import java.io.*;
import java.net.URL;
+import java.text.NumberFormat;
import java.util.*;
import org.apache.log4j.Logger;
@@ -52,9 +53,20 @@
@Override
public void execute() throws ExecutionException {
+ interrupted = false;
+ long startTime = System.currentTimeMillis();
+ if(document == null) {
+ throw new ExecutionException("No document to process!");
+ }
+ fireStatusChanged("Running " + this.getName() + " on " +
document.getName());
+ fireProgressChanged(0);
+
AnnotationSet inputAS = document.getAnnotations(inputASName);
AnnotationSet outputAS = document.getAnnotations(outputASName);
AnnotationSet sentences = inputAS.get(sentenceType);
+
+ int nbrDone = 0;
+ int nbrSentences = sentences.size();
for (Annotation sentence : sentences) {
/* For each input Sentence annotation, produce a list of
@@ -81,9 +93,22 @@
catch (InvalidOffsetException e) {
throw new ExecutionException(e);
}
- }
- }
- }
+
+ if(isInterrupted()) {
+ throw new ExecutionInterruptedException("Execution of "
+
+ this.getName() + " has been abruptly interrupted!");
+ }
+ } // end loop over names from 1 finder in 1 sentence
+ } // end loop over NameFinders within one sentence
+ nbrDone++;
+ fireProgressChanged((int)(100 * nbrDone / nbrSentences));
+ } // end for sentence : sentences
+
+ fireProcessFinished();
+ fireStatusChanged("Finished " + this.getName() + " on " +
document.getName()
+ + " in " + NumberFormat.getInstance().format(
+ (double)(System.currentTimeMillis() - startTime) / 1000)
+ + " seconds!");
}
Modified: gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpChunker.java
===================================================================
--- gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpChunker.java
2012-11-13 13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpChunker.java
2012-11-13 14:29:47 UTC (rev 16262)
@@ -19,6 +19,8 @@
import gate.util.InvalidOffsetException;
import java.io.*;
import java.net.URL;
+import java.text.NumberFormat;
+
import opennlp.tools.chunker.ChunkerME;
import opennlp.tools.chunker.ChunkerModel;
import org.apache.log4j.Logger;
@@ -49,11 +51,22 @@
@Override
public void execute() throws ExecutionException {
- AnnotationSet inputAS = document.getAnnotations(inputASName);
+ interrupted = false;
+ long startTime = System.currentTimeMillis();
+ if(document == null) {
+ throw new ExecutionException("No document to process!");
+ }
+ fireStatusChanged("Running " + this.getName() + " on " +
document.getName());
+ fireProgressChanged(0);
+
+AnnotationSet inputAS = document.getAnnotations(inputASName);
AnnotationSet outputAS = document.getAnnotations(outputASName);
boolean sameAS = inputAS.equals(outputAS);
AnnotationSet sentences = inputAS.get(sentenceType);
+ int nbrDone = 0;
+ int nbrSentences = sentences.size();
+
for (Annotation sentence : sentences) {
AnnotationSet tokenSet =
Utils.getContainedAnnotations(inputAS, sentence, tokenType);
Sentence tokens = new Sentence(tokenSet, stringFeature, posFeature);
@@ -85,8 +98,21 @@
throw new ExecutionException(e);
}
}
- }
- }
+ if(isInterrupted()) {
+ throw new ExecutionInterruptedException("Execution of " +
+ this.getName() + " has been abruptly interrupted!");
+ }
+ } // end loop over chunk tags within one sentence
+
+ nbrDone++;
+ fireProgressChanged((int)(100 * nbrDone / nbrSentences));
+ } // end for sentence : sentences
+
+ fireProcessFinished();
+ fireStatusChanged("Finished " + this.getName() + " on " +
document.getName()
+ + " in " + NumberFormat.getInstance().format(
+ (double)(System.currentTimeMillis() - startTime) / 1000)
+ + " seconds!");
}
@@ -98,7 +124,7 @@
modelInput = modelUrl.openStream();
this.model = new ChunkerModel(modelInput);
this.chunker = new ChunkerME(model);
- logger.info("OpenNLP POS Chunker initialized!");
+ logger.info("OpenNLP POS Chunker: " + modelUrl.toString());
}
catch(IOException e) {
throw new ResourceInstantiationException(e);
Modified: gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpPOS.java
===================================================================
--- gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpPOS.java 2012-11-13
13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpPOS.java 2012-11-13
14:29:47 UTC (rev 16262)
@@ -108,6 +108,7 @@
throw new ExecutionInterruptedException("Execution of " +
this.getName() + " has been abruptly interrupted!");
}
+ nbrDone++;
fireProgressChanged((int)(100 * nbrDone / nbrSentences));
} // for sentence : sentences
@@ -126,7 +127,7 @@
modelInput = modelUrl.openStream();
this.model = new POSModel(modelInput);
this.tagger = new POSTaggerME(model);
- logger.info("OpenNLP POS Tagger initialized!");
+ logger.info("OpenNLP POS Tagger: " + modelUrl.toString());
}
catch(IOException e) {
throw new ResourceInstantiationException(e);
Modified: gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpSentenceSplit.java
===================================================================
--- gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpSentenceSplit.java
2012-11-13 13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpSentenceSplit.java
2012-11-13 14:29:47 UTC (rev 16262)
@@ -19,6 +19,8 @@
import gate.util.InvalidOffsetException;
import java.io.*;
import java.net.URL;
+import java.text.NumberFormat;
+
import opennlp.tools.sentdetect.*;
import opennlp.tools.util.Span;
import org.apache.log4j.Logger;
@@ -47,11 +49,21 @@
@Override
public void execute() throws ExecutionException {
+ interrupted = false;
+ long startTime = System.currentTimeMillis();
+ if(document == null) {
+ throw new ExecutionException("No document to process!");
+ }
+ fireStatusChanged("Running " + this.getName() + " on " +
document.getName());
+ fireProgressChanged(0);
+
AnnotationSet annotations =
document.getAnnotations(annotationSetName);
String text = document.getContent().toString();
+ checkInterruption();
Span[] spans = splitter.sentPosDetect(text);
for (Span span : spans) {
+ checkInterruption();
FeatureMap fm = Factory.newFeatureMap();
fm.put("source", "OpenNLP");
long start = (long) span.getStart();
@@ -65,7 +77,16 @@
}
}
- //TODO: generate Split annotations!
+ //TODO: generate Split annotations.
+
+ //TODO: maybe generate SpaceToken annotations where the
+ // Sentence ones don't meet.
+
+ fireProcessFinished();
+ fireStatusChanged("Finished " + this.getName() + " on " +
document.getName()
+ + " in " + NumberFormat.getInstance().format(
+ (double)(System.currentTimeMillis() - startTime) / 1000)
+ + " seconds!");
}
@@ -76,7 +97,7 @@
modelInput = modelUrl.openStream();
this.model = new SentenceModel(modelInput);
this.splitter = new SentenceDetectorME(model);
- logger.info("OpenNLP Splitter initialized!");
+ logger.info("OpenNLP Splitter: " + modelUrl.toString());
}
catch(IOException e) {
throw new ResourceInstantiationException(e);
@@ -103,6 +124,14 @@
}
+ private void checkInterruption() throws ExecutionInterruptedException {
+ if(isInterrupted()) {
+ throw new ExecutionInterruptedException("Execution of " +
+ this.getName() + " has been abruptly interrupted!");
+ }
+ }
+
+
/* CREOLE PARAMETERS */
@RunTime
Modified: gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpTokenizer.java
===================================================================
--- gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpTokenizer.java
2012-11-13 13:37:58 UTC (rev 16261)
+++ gate/trunk/plugins/OpenNLP/src/gate/opennlp/OpenNlpTokenizer.java
2012-11-13 14:29:47 UTC (rev 16262)
@@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.text.NumberFormat;
import java.util.*;
import org.apache.log4j.Logger;
import opennlp.tools.tokenize.TokenizerME;
@@ -50,18 +51,28 @@
public void execute() throws ExecutionException {
- AnnotationSet annotations =
document.getAnnotations(annotationSetName);
+ interrupted = false;
+ long startTime = System.currentTimeMillis();
+ if(document == null) {
+ throw new ExecutionException("No document to process!");
+ }
+ fireStatusChanged("Running " + this.getName() + " on " +
document.getName());
+ fireProgressChanged(0);
+
+ AnnotationSet annotations = document.getAnnotations(annotationSetName);
String text = document.getContent().toString();
+ checkInterruption();
Span[] spans = tokenizer.tokenizePos(text);
/* The spans ought to be ordered, but the OpenNLP
- * API is unclear. We need them in order so we can
- * spot the gaps and put SpaceToken annotations
- * in them. */
+ * API is unclear. We need to be sure they are in
+ * order so we can spot the gaps and put Space
+ * Token annotations on them. */
Arrays.sort(spans);
long previousEnd = 0;
for (Span span : spans) {
+ checkInterruption();
long start = (long) span.getStart();
long end = (long) span.getEnd();
@@ -88,16 +99,30 @@
throw new ExecutionException(e);
}
}
+
+ fireProcessFinished();
+ fireStatusChanged("Finished " + this.getName() + " on " +
document.getName()
+ + " in " + NumberFormat.getInstance().format(
+ (double)(System.currentTimeMillis() - startTime) / 1000)
+ + " seconds!");
}
+ private void checkInterruption() throws ExecutionInterruptedException {
+ if(isInterrupted()) {
+ throw new ExecutionInterruptedException("Execution of " +
+ this.getName() + " has been abruptly interrupted!");
+ }
+ }
+
+
public Resource init() throws ResourceInstantiationException {
InputStream modelInput = null;
try {
modelInput = modelUrl.openStream();
this.model = new TokenizerModel(modelInput);
this.tokenizer = new TokenizerME(model);
- logger.info("OpenNLP Tokenizer initialized!");
+ logger.info("OpenNLP Tokenizer: " + modelUrl.toString());
}
catch(IOException e) {
throw new ResourceInstantiationException(e);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs