Revision: 19340
http://sourceforge.net/p/gate/code/19340
Author: ian_roberts
Date: 2016-05-24 12:16:24 +0000 (Tue, 24 May 2016)
Log Message:
-----------
Removed the compile time dependency of Twitter on Stanford_CoreNLP. This does
mean that "Twitter PoS Tagger" no longer appears as an option in the new PR
menu, but I've added a ready-made app with just the POS tagger to compensate.
Modified Paths:
--------------
gate/trunk/plugins/Twitter/build.xml
gate/trunk/plugins/Twitter/creole.xml
gate/trunk/plugins/Twitter/src/gate/twitter/pos/POSTaggerEN.java
Added Paths:
-----------
gate/trunk/plugins/Twitter/resources/twitie-pos-tagger.xgapp
gate/trunk/plugins/Twitter/src/gate/twitter/apps/TwitIEPOS.java
Modified: gate/trunk/plugins/Twitter/build.xml
===================================================================
--- gate/trunk/plugins/Twitter/build.xml 2016-05-24 10:28:10 UTC (rev
19339)
+++ gate/trunk/plugins/Twitter/build.xml 2016-05-24 12:16:24 UTC (rev
19340)
@@ -22,13 +22,6 @@
<include name="*.zip" />
</fileset>
- <!-- we also need to pull in the Tagger_Stanford jars -->
- <fileset id="stanford.libs" dir="../Stanford_CoreNLP">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
-
-
<fileset id="gatelib.classpath" dir="${gate.home}/lib">
<include name="*.jar" />
<include name="*.zip" />
@@ -41,7 +34,6 @@
<path id="compile.classpath">
<fileset refid="libs" />
- <fileset refid="stanford.libs" />
<fileset refid="gatelib.classpath" />
<fileset refid="gate.classpath" />
</path>
Modified: gate/trunk/plugins/Twitter/creole.xml
===================================================================
--- gate/trunk/plugins/Twitter/creole.xml 2016-05-24 10:28:10 UTC (rev
19339)
+++ gate/trunk/plugins/Twitter/creole.xml 2016-05-24 12:16:24 UTC (rev
19340)
@@ -3,5 +3,4 @@
<JAR SCAN="true">twitter.jar</JAR>
<JAR>lib/jaspell.jar</JAR>
<REQUIRES>../Format_Twitter</REQUIRES>
- <REQUIRES>../Stanford_CoreNLP</REQUIRES>
</CREOLE-DIRECTORY>
Added: gate/trunk/plugins/Twitter/resources/twitie-pos-tagger.xgapp
===================================================================
--- gate/trunk/plugins/Twitter/resources/twitie-pos-tagger.xgapp
(rev 0)
+++ gate/trunk/plugins/Twitter/resources/twitie-pos-tagger.xgapp
2016-05-24 12:16:24 UTC (rev 19340)
@@ -0,0 +1,59 @@
+<gate.util.persistence.GateApplication>
+ <urlList class="gate.util.persistence.CollectionPersistence">
+ <localList>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$../../Stanford_CoreNLP</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>
+ <pr class="gate.util.persistence.LanguageAnalyserPersistence">
+ <runtimeParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap/>
+ </runtimeParams>
+ <resourceType>gate.stanford.Tagger</resourceType>
+ <resourceName>Tweet PoS Tagger (EN)</resourceName>
+ <initParams class="gate.util.persistence.MapPersistence">
+ <mapType>gate.util.SimpleFeatureMapImpl</mapType>
+ <localMap>
+ <entry>
+ <string>modelFile</string>
+ <gate.util.persistence.PersistenceManager-URLHolder>
+ <urlString>$relpath$pos/gate-EN-twitter.model</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.LanguageAnalyserPersistence
reference="../../../strategiesList/localList/gate.util.persistence.AnalyserRunningStrategyPersistence/pr"/>
+ </localList>
+ <collectionType>java.util.ArrayList</collectionType>
+ </prList>
+
<resourceType>gate.creole.ConditionalSerialAnalyserController</resourceType>
+ <resourceName>TwitIE PoS Tagger pipeline</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>
Added: gate/trunk/plugins/Twitter/src/gate/twitter/apps/TwitIEPOS.java
===================================================================
--- gate/trunk/plugins/Twitter/src/gate/twitter/apps/TwitIEPOS.java
(rev 0)
+++ gate/trunk/plugins/Twitter/src/gate/twitter/apps/TwitIEPOS.java
2016-05-24 12:16:24 UTC (rev 19340)
@@ -0,0 +1,31 @@
+/*
+ * TwitIEPOS.java
+ *
+ * Copyright (c) 2013, 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).
+ *
+ * Mark A. Greenwood, 06/09/2013
+ */
+
+package gate.twitter.apps;
+
+import gate.creole.PackagedController;
+import gate.creole.metadata.AutoInstance;
+import gate.creole.metadata.AutoInstanceParam;
+import gate.creole.metadata.CreoleResource;
+
+@CreoleResource(name = "TwitIE PoS Tagger",
+ comment = "English TwitIE part-of-speech tagger",
+ autoinstances = @AutoInstance(parameters = {
+ @AutoInstanceParam(name="pipelineURL",
value="resources/twitie-pos-tagger.xgapp"),
+ @AutoInstanceParam(name="menu", value="TwitIE")}))
+public class TwitIEPOS extends PackagedController {
+
+ private static final long serialVersionUID = 3419027514263819064L;
+
+}
Property changes on:
gate/trunk/plugins/Twitter/src/gate/twitter/apps/TwitIEPOS.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: gate/trunk/plugins/Twitter/src/gate/twitter/pos/POSTaggerEN.java
===================================================================
--- gate/trunk/plugins/Twitter/src/gate/twitter/pos/POSTaggerEN.java
2016-05-24 10:28:10 UTC (rev 19339)
+++ gate/trunk/plugins/Twitter/src/gate/twitter/pos/POSTaggerEN.java
2016-05-24 12:16:24 UTC (rev 19340)
@@ -1,7 +1,7 @@
/*
* POSTaggerEN.java
*
- * Copyright (c) 2013, The University of Sheffield. See the file COPYRIGHT.txt
+ * Copyright (c) 2016, 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,
@@ -9,29 +9,265 @@
* (in the distribution as file licence.html, and also available at
* http://gate.ac.uk/gate/licence.html).
*
- * Mark A. Greenwood, 06/09/2013
+ * Ian Roberts, 24/05/2016
*/
package gate.twitter.pos;
import java.net.URL;
+import gate.Corpus;
+import gate.Document;
+import gate.Factory;
+import gate.Factory.DuplicationContext;
+import gate.FeatureMap;
+import gate.Gate;
+import gate.LanguageAnalyser;
+import gate.Resource;
+import gate.creole.AbstractLanguageAnalyser;
+import gate.creole.CustomDuplication;
+import gate.creole.ExecutionException;
+import gate.creole.ResourceInstantiationException;
import gate.creole.metadata.CreoleParameter;
-import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
+import gate.creole.metadata.RunTime;
+import gate.event.ProgressListener;
+import gate.event.StatusListener;
-import gate.stanford.Tagger;
+/**
+ * Transitional compatibility PR to allow saved applications created
+ * with the GATE 8.0 version of TwitIE to continue operating in this
+ * version. New applications should not use this class, they should
+ * instantiate a Stanford Tagger PR directly with the appropriate model.
+ */
+@CreoleResource(name = "Twitter POS Tagger (deprecated)", comment =
"Transitional compatibility PR for Twitter POS tagger - new applications should
use the Stanford tagger directly", isPrivate = true)
+public class POSTaggerEN extends AbstractLanguageAnalyser implements
+ CustomDuplication {
-@CreoleResource(name = "Twitter POS Tagger (EN)",
- comment = "Stanford POS tagger trained on Tweets",
- helpURL = "http://gate.ac.uk/userguide/sec:social:twitter:prs")
-public class POSTaggerEN extends Tagger {
+ private FeatureMap initParams;
- private static final long serialVersionUID = 5657607888874448666L;
+ private FeatureMap runtimeParams;
- @Override
- @CreoleParameter(comment = "Path to the tagger's model file",
- defaultValue = "resources/pos/gate-EN-twitter.model")
+ private AbstractLanguageAnalyser delegate;
+
+ public Resource init() throws ResourceInstantiationException {
+ if(delegate == null) {
+ FeatureMap features = Factory.newFeatureMap();
+ Gate.setHiddenAttribute(features, true);
+ delegate =
+ (AbstractLanguageAnalyser)Factory.createResource(
+ "gate.stanford.Tagger", getInitParams(), features,
+ getName());
+ }
+ return this;
+ }
+
+ public void reInit() throws ResourceInstantiationException {
+ delegate.setParameterValues(getInitParams());
+ delegate.reInit();
+ }
+
+ public void execute() throws ExecutionException {
+ try {
+ delegate.setParameterValues(getRuntimeParams());
+ } catch(ResourceInstantiationException e) {
+ // TODO Auto-generated catch block
+ throw new ExecutionException(e);
+ }
+ delegate.execute();
+ }
+
+ /**
+ * Only for use by duplication mechanism.
+ */
+ public void setDelegate(AbstractLanguageAnalyser delegate) {
+ this.delegate = delegate;
+ }
+
+ public AbstractLanguageAnalyser getDelegate() {
+ return delegate;
+ }
+
+ /**
+ * Only for use by duplication mechanism.
+ */
+ public void setInitParams(FeatureMap initParams) {
+ this.initParams = initParams;
+ }
+
+ public FeatureMap getInitParams() {
+ if(initParams == null) {
+ initParams = Factory.newFeatureMap();
+ }
+ return initParams;
+ }
+
+ /**
+ * Only for use by duplication mechanism.
+ */
+ public void setRuntimeParams(FeatureMap runtimeParams) {
+ this.runtimeParams = runtimeParams;
+ }
+
+ public FeatureMap getRuntimeParams() {
+ if(runtimeParams == null) {
+ runtimeParams = Factory.newFeatureMap();
+ }
+ return runtimeParams;
+ }
+
+ // init parameters
+
+ @CreoleParameter(comment = "Path to the tagger's model file", defaultValue =
"resources/pos/gate-EN-twitter.model")
public void setModelFile(URL modelFile) {
- super.setModelFile(modelFile);
+ getInitParams().put("modelFile", modelFile);
}
+
+ public URL getModelFile() {
+ return (URL)getInitParams().get("modelFile");
+ }
+
+ // runtime parameters
+
+ @Optional
+ @RunTime
+ @CreoleParameter
+ public void setInputASName(String inputASName) {
+ getRuntimeParams().put("inputASName", inputASName);
+ }
+
+ public String getInputASName() {
+ return (String)getRuntimeParams().get("inputASName");
+ }
+
+ @Optional
+ @RunTime
+ @CreoleParameter
+ public void setOutputASName(String outputASName) {
+ getRuntimeParams().put("outputASName", outputASName);
+ }
+
+ public String getOutputASName() {
+ return (String)getRuntimeParams().get("outputASName");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "true")
+ public void setFailOnMissingInputAnnotations(Boolean fail) {
+ getRuntimeParams().put("failOnMissingInputAnnotations", fail);
+ }
+
+ public Boolean getFailOnMissingInputAnnotations() {
+ return (Boolean)getRuntimeParams().get("failOnMissingInputAnnotations");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "true")
+ public void setPosTagAllTokens(Boolean tag) {
+ getRuntimeParams().put("posTagAllTokens", tag);
+ }
+
+ public Boolean getPosTagAllTokens() {
+ return (Boolean)getRuntimeParams().get("posTagAllTokens");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "Token")
+ public void setBaseTokenAnnotationType(String type) {
+ getRuntimeParams().put("baseTokenAnnotationType", type);
+ }
+
+ public String getBaseTokenAnnotationType() {
+ return (String)getRuntimeParams().get("baseTokenAnnotationType");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "Sentence")
+ public void setBaseSentenceAnnotationType(String type) {
+ getRuntimeParams().put("baseSentenceAnnotationType", type);
+ }
+
+ public String getBaseSentenceAnnotationType() {
+ return (String)getRuntimeParams().get("baseSentenceAnnotationType");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "Token")
+ public void setOutputAnnotationType(String type) {
+ getRuntimeParams().put("outputAnnotationType", type);
+ }
+
+ public String getOutputAnnotationType() {
+ return (String)getRuntimeParams().get("outputAnnotationType");
+ }
+
+ @RunTime
+ @CreoleParameter(defaultValue = "true")
+ public void setUseExistingTags(Boolean tag) {
+ getRuntimeParams().put("useExistingTags", tag);
+ }
+
+ public Boolean getUseExistingTags() {
+ return (Boolean)getRuntimeParams().get("useExistingTags");
+ }
+
+ public void setCorpus(Corpus c) {
+ delegate.setCorpus(c);
+ }
+
+ public Corpus getCorpus() {
+ return delegate.getCorpus();
+ }
+
+ public void setDocument(Document doc) {
+ delegate.setDocument(doc);
+ }
+
+ public Document getDocument() {
+ return delegate.getDocument();
+ }
+
+ // listener registration
+
+ @Override
+ public synchronized void removeStatusListener(StatusListener l) {
+ if(delegate != null) {
+ delegate.removeStatusListener(l);
+ }
+ }
+
+ @Override
+ public synchronized void addStatusListener(StatusListener l) {
+ if(delegate != null) {
+ delegate.addStatusListener(l);
+ }
+ }
+
+ @Override
+ public synchronized void addProgressListener(ProgressListener l) {
+ if(delegate != null) {
+ delegate.addProgressListener(l);
+ }
+ }
+
+ @Override
+ public synchronized void removeProgressListener(ProgressListener l) {
+ if(delegate != null) {
+ delegate.removeProgressListener(l);
+ }
+ }
+
+ @Override
+ public Resource duplicate(DuplicationContext ctx)
+ throws ResourceInstantiationException {
+ FeatureMap newParams = Factory.newFeatureMap();
+ newParams.put("initParams", Factory.duplicate(getInitParams(), ctx));
+ newParams.put("runtimeParams", Factory.duplicate(getRuntimeParams(), ctx));
+ newParams.put("delegate", Factory.duplicate(delegate, ctx));
+ FeatureMap newFeatures = Factory.duplicate(getFeatures(), ctx);
+ return Factory.createResource(POSTaggerEN.class.getName(), newParams,
+ newFeatures, getName());
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs