Revision: 19912
http://sourceforge.net/p/gate/code/19912
Author: markagreenwood
Date: 2017-01-04 13:17:07 +0000 (Wed, 04 Jan 2017)
Log Message:
-----------
merged in the fix for the nasty URL hackery
Modified Paths:
--------------
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
Property Changed:
----------------
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
Modified:
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
===================================================================
---
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
2017-01-04 13:06:20 UTC (rev 19911)
+++
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
2017-01-04 13:17:07 UTC (rev 19912)
@@ -21,6 +21,19 @@
*/
package gate.stanford;
+import java.io.InputStream;
+import java.net.URL;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.zip.GZIPInputStream;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
import edu.stanford.nlp.ie.AbstractSequenceClassifier;
import edu.stanford.nlp.ie.crf.CRFClassifier;
import edu.stanford.nlp.ling.CoreAnnotations;
@@ -41,17 +54,6 @@
import gate.util.OffsetComparator;
import gate.util.SimpleFeatureMapImpl;
-import java.net.URL;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
/**
* This class is a wrapper for the Stanford NER tool v3.2.0.
*/
@@ -94,10 +96,9 @@
public Resource init() throws ResourceInstantiationException {
if(tagger == null) {
fireStatusChanged("Loading Stanford NER model");
- try {
- // nasty workaround for stanford NER's path format inconsistency -
- // tagger is content with uris beginning file:, ner labeller is not
- tagger =
CRFClassifier.getClassifier(modelFile.toString().substring(5));
+ try (InputStream in = modelFile.openStream();
+ GZIPInputStream gzipIn = new GZIPInputStream(in)){
+ tagger = CRFClassifier.getClassifier(gzipIn);
} catch(Exception e) {
throw new ResourceInstantiationException(e);
}
@@ -188,10 +189,12 @@
Iterator<CoreLabel> resIter = taggerResults.iterator();
Iterator<Annotation> tokIter = tokensInCurrentSentence.iterator();
String previousLabel = outsideLabel;
- Long previousEnd = -1L;
- Long entityStart = -1L;
- // No idea why this was there so lets comment it out
- // Long entityEnd = new Long(-1);
+ Long previousEnd = new Long(-1);
+ Long entityStart = new Long(-1);
+
+ //No idea why this was there so lets comment it out
+ //Long entityEnd = new Long(-1);
+
Annotation annot;
String nerLabel = "";
while(resIter.hasNext()) {
Property changes on:
gate/branches/sawdust2/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java
___________________________________________________________________
Added: svn:mergeinfo
## -0,0 +1,7 ##
+/gate/branches/new-ontology-api/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:10584-11598
+/gate/branches/release-7.0/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:15335-15398
+/gate/branches/release-8.1/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:18736-18747
+/gate/branches/sawdust/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:17055-17079
+/gate/tags/release-7.0/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:15399-15407
+/gate/trunk/plugins/Stanford_CoreNLP/src/gate/stanford/NER.java:19180-19911
+/gate/trunk/plugins/Stanford_CoreNLP/src/main/java/gate/stanford/NER.java:3-390,19180-19522
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs