Revision: 19173
          http://sourceforge.net/p/gate/code/19173
Author:   markagreenwood
Date:     2016-04-01 10:16:42 +0000 (Fri, 01 Apr 2016)
Log Message:
-----------
moved the metadata for the POS tagger out of creole.xml

Modified Paths:
--------------
    gate/trunk/plugins/Lang_Welsh/creole.xml
    gate/trunk/plugins/Lang_Welsh/src/wnlt/WelshPOSTagger.java

Modified: gate/trunk/plugins/Lang_Welsh/creole.xml
===================================================================
--- gate/trunk/plugins/Lang_Welsh/creole.xml    2016-04-01 09:55:03 UTC (rev 
19172)
+++ gate/trunk/plugins/Lang_Welsh/creole.xml    2016-04-01 10:16:42 UTC (rev 
19173)
@@ -7,47 +7,6 @@
     <REQUIRES>../ANNIE</REQUIRES>
 
     <RESOURCE>
-    <!-- Part of Speech Tagger Processing Resource -->
-      <NAME>Welsh POS Tagger</NAME>
-      <COMMENT>Mark Hepple's Brill-style POS tagger, adapted for 
Welsh</COMMENT>
-      <CLASS>wnlt.WelshPOSTagger</CLASS>
-      <PARAMETER NAME="document"
-        COMMENT="The document to be processed"
-        RUNTIME="true">gate.Document</PARAMETER>
-      <PARAMETER NAME="inputASName"
-        COMMENT="The name of the annotation set used for input"
-        RUNTIME="true" OPTIONAL="true">java.lang.String</PARAMETER>
-      <PARAMETER NAME="outputASName"
-        COMMENT="The name of the annotation set used for output"
-        RUNTIME="true" OPTIONAL="true">java.lang.String</PARAMETER>
-      <PARAMETER NAME="baseSentenceAnnotationType"
-        COMMENT="The base Sentence Annotation Type"
-        RUNTIME="true" OPTIONAL="false" 
DEFAULT="Sentence">java.lang.String</PARAMETER>
-      <PARAMETER NAME="baseTokenAnnotationType"
-        COMMENT="The base Token Annotation Type"
-        RUNTIME="true" OPTIONAL="false" 
DEFAULT="Token">java.lang.String</PARAMETER>
-      <PARAMETER NAME="failOnMissingInputAnnotations"
-        COMMENT="Boolean on failOnMissingInputAnnotations"
-        RUNTIME="true" OPTIONAL="true">java.lang.Boolean</PARAMETER>
-      <PARAMETER NAME="outputAnnotationType"
-        COMMENT="The output Token Annotation Type"
-        RUNTIME="true" OPTIONAL="false" 
DEFAULT="Token">java.lang.String</PARAMETER>
-      <PARAMETER NAME="posTagAllTokens"
-        COMMENT="The posTagAllTokens"
-        RUNTIME="true" OPTIONAL="true" 
DEFAULT="true">java.lang.Boolean</PARAMETER>
-      <PARAMETER NAME="lexiconURL" DEFAULT="resources/postag/lexicon"
-        COMMENT="The URL for the lexicon file"
-        >java.net.URL</PARAMETER>
-      <PARAMETER NAME="rulesURL" DEFAULT="resources/postag/ruleset"
-        COMMENT="The URL for the ruleset file"
-        >java.net.URL</PARAMETER>
-      <PARAMETER NAME="encoding"
-        DEFAULT="UTF-8"
-        COMMENT="The encoding to be used for the ruleset and lexicon files"
-        >java.lang.String</PARAMETER>
-      <ICON>welsh_pos.png</ICON>
-    </RESOURCE>
-    <RESOURCE>
     <!-- Morphological Analyser Processing Resource -->
       <NAME>Welsh Morphological Analyser</NAME>
       <COMMENT>Morphological Ananyser for Welsh</COMMENT>

Modified: gate/trunk/plugins/Lang_Welsh/src/wnlt/WelshPOSTagger.java
===================================================================
--- gate/trunk/plugins/Lang_Welsh/src/wnlt/WelshPOSTagger.java  2016-04-01 
09:55:03 UTC (rev 19172)
+++ gate/trunk/plugins/Lang_Welsh/src/wnlt/WelshPOSTagger.java  2016-04-01 
10:16:42 UTC (rev 19173)
@@ -1,40 +1,59 @@
 /*
- *  WelshPOSTagger.java
- *  This file is part of Welsh Natural Language Toolkit (WNLT)
- *  (see http://gate.ac.uk/), and is free software, licenced under 
- *  the GNU Library General Public License, Version 2, June 1991
- *  
- *  
+ * WelshPOSTagger.java This file is part of Welsh Natural Language Toolkit
+ * (WNLT) (see http://gate.ac.uk/), and is free software, licenced under the 
GNU
+ * Library General Public License, Version 2, June 1991
  */
 package wnlt;
+
 import gate.Resource;
 import gate.creole.POSTagger;
 import gate.creole.ResourceInstantiationException;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
 
+import java.net.URL;
+
 /**
- * This class is a wrapper for the WNLT class HeppleCY which extends the the 
Hepple's POS Tagger
+ * This class is a wrapper for the WNLT class HeppleCY which extends the the
+ * Hepple's POS Tagger
+ * 
  * @author Andreas Vlachidis 20/03/2016
  */
-public class WelshPOSTagger extends POSTagger{
+@CreoleResource(name = "Welsh POS Tagger", comment = "Mark Hepple's 
Brill-style POS tagger, adapted for Welsh", icon="welsh_pos.png")
+public class WelshPOSTagger extends POSTagger {
 
-       private static final long serialVersionUID = 1L;
-       
-        @Override
-         public Resource init()throws ResourceInstantiationException{
-                if(getLexiconURL() == null){
-                     throw new ResourceInstantiationException(
-                       "NoURL provided for the lexicon!");
-                   }
-                   if(getRulesURL() == null){
-                     throw new ResourceInstantiationException(
-                       "No URL provided for the rules!");
-                   }
-           try{
-             tagger = new wnlt.HeppleCY(getLexiconURL(),getRulesURL(), 
getEncoding());
-           }catch(Exception e){
-             throw new ResourceInstantiationException(e);
-           }
-           return this;
-         }
+  private static final long serialVersionUID = 1L;
 
+  @Override
+  public Resource init() throws ResourceInstantiationException {
+    if(getLexiconURL() == null) { throw new ResourceInstantiationException(
+      "NoURL provided for the lexicon!"); }
+    if(getRulesURL() == null) { throw new ResourceInstantiationException(
+      "No URL provided for the rules!"); }
+    try {
+      tagger = new wnlt.HeppleCY(getLexiconURL(), getRulesURL(), 
getEncoding());
+    } catch(Exception e) {
+      throw new ResourceInstantiationException(e);
+    }
+    return this;
+  }
+
+  @Override
+  @CreoleParameter(defaultValue = "resources/postag/lexicon")
+  public void setLexiconURL(URL newLexiconURL) {
+    super.setLexiconURL(newLexiconURL);
+  }
+  
+  @Override
+  @CreoleParameter(defaultValue = "resources/postag/ruleset")
+  public void setRulesURL(URL newRulesURL) {
+    super.setRulesURL(newRulesURL);
+  }
+  
+  @Override
+  @CreoleParameter(defaultValue="UTF-8")
+  public void setEncoding(String encoding) {
+    super.setEncoding(encoding);
+  }
+
 }

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


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to