Revision: 16802
          http://sourceforge.net/p/gate/code/16802
Author:   markagreenwood
Date:     2013-08-16 06:45:06 +0000 (Fri, 16 Aug 2013)
Log Message:
-----------
switched fully to creole annotations (including hidding params we don't support)

Modified Paths:
--------------
    gate/trunk/plugins/Lang_Russian/creole.xml
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java

Modified: gate/trunk/plugins/Lang_Russian/creole.xml
===================================================================
--- gate/trunk/plugins/Lang_Russian/creole.xml  2013-08-16 06:21:46 UTC (rev 
16801)
+++ gate/trunk/plugins/Lang_Russian/creole.xml  2013-08-16 06:45:06 UTC (rev 
16802)
@@ -1,45 +1,5 @@
 <?xml version="1.0"?>
 <CREOLE-DIRECTORY>
-
-  <JAR>russie.jar</JAR>
-    
- <!-- Processing Resources -->
-  <CREOLE>
-    <!-- Russ Gazetteer -->
-     <RESOURCE>
-      <NAME>Russ Gazetteer</NAME>
-      <CLASS>com.ontotext.russie.gazetteer.RussGazetteer</CLASS>
-      <PARAMETER NAME="document" RUNTIME="true"
-        COMMENT="The document to be processed">gate.Document</PARAMETER>
-      <PARAMETER NAME="listsURL"
-     DEFAULT="gate:/creole/resources/gazeteer/lists.def" 
-        COMMENT="The URL to the file with list of lists"
-  SUFFIXES="def">java.net.URL</PARAMETER>
-      <PARAMETER DEFAULT="UTF-8"
-        COMMENT="The encoding used for reading the definitions and lists"
-  NAME="encoding">java.lang.String</PARAMETER>
-      <ICON>shefGazetteer.gif</ICON>
-    </RESOURCE>
-
-    <!-- POS Tagger -->
-     <RESOURCE>
-      <CLASS>com.ontotext.russie.morph.POSTagger</CLASS>
-    </RESOURCE>
-
-
-   <!-- Inflectional Gazetteer -->
-     <RESOURCE>
-      <CLASS>com.ontotext.russie.gazetteer.InflectionalGazetteer</CLASS>
-    </RESOURCE>
-
-
-    <!-- POS Mapper -->
-     <RESOURCE>
-      <CLASS>com.ontotext.russie.morph.POSMapper</CLASS>
-    </RESOURCE>
-
-   </CREOLE>
-
-  
+  <JAR SCAN="TRUE">russie.jar</JAR>  
 </CREOLE-DIRECTORY>
 

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
        2013-08-16 06:21:46 UTC (rev 16801)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
        2013-08-16 06:45:06 UTC (rev 16802)
@@ -22,6 +22,7 @@
 import gate.AnnotationSet;
 import gate.FeatureMap;
 import gate.Resource;
+import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
 import gate.creole.metadata.CreoleParameter;
@@ -50,15 +51,11 @@
 import com.ontotext.russie.morph.TypePool;
 
 @CreoleResource(name = "Inflectional gazetteer")
-public class InflectionalGazetteer extends gate.creole.AbstractLanguageAnalyser
-  implements RussIEConstants {
+public class InflectionalGazetteer extends AbstractLanguageAnalyser implements
+  RussIEConstants {
 
   private static final long serialVersionUID = -6564083196195936381L;
 
-  public InflectionalGazetteer() {
-    mapsList = new ArrayList<Map>(10);
-  }
-
   /**
    * Debug flag
    */
@@ -102,7 +99,7 @@
    * etc. each map's value might be an ArrayList of TYpe objects specifying
    * categories tied to this word/phrase.
    */
-  protected List<Map> mapsList;
+  protected List<Map> mapsList = new ArrayList<Map>(10);
 
   /**
    * size of the mapsList
@@ -504,7 +501,7 @@
   public Set<List> lookup(String wordForm) {
     Set<List> result = null;
     for(int li = 0; li < mapsListSize; li++) {
-      Map<String,List> list = mapsList.get(li);
+      Map<String, List> list = mapsList.get(li);
       if(list.containsKey(wordForm)) {
         List<List> lookupList = list.get(wordForm);
         if(lookupList != null && lookupList.size() > 0) {
@@ -519,7 +516,7 @@
   public boolean remove(String wordForm) {
     boolean isRemoved = false;
     for(int i = 0; i < mapsListSize; i++) {
-      Map<String,List> map = mapsList.get(i);
+      Map<String, List> map = mapsList.get(i);
       if(map.containsKey(wordForm)) {
         map.remove(wordForm);
         isRemoved = true;

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
        2013-08-16 06:21:46 UTC (rev 16801)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
        2013-08-16 06:45:06 UTC (rev 16802)
@@ -39,6 +39,10 @@
 import gate.creole.gazetteer.LinearNode;
 import gate.creole.gazetteer.Lookup;
 import gate.creole.gazetteer.MappingNode;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.HiddenCreoleParameter;
+import gate.creole.metadata.RunTime;
 import gate.util.InvalidOffsetException;
 import gate.util.LuckyException;
 
@@ -60,6 +64,7 @@
  * @author borislav popov
  * @version 1.0
  */
+@CreoleResource(name = "Russian Gazetteer", icon = "shefGazetteer")
 public class RussGazetteer extends AbstractGazetteer implements 
RussIEConstants {
 
   private static final long serialVersionUID = -5174914553200046785L;
@@ -173,11 +178,11 @@
       // allocate the category Map with optimal initial capacity & load factor
       categoryList = new ArrayList<Lookup>(linesCnt + 1);
 
-      Iterator inodes = definition.iterator();
+      Iterator<LinearNode> inodes = definition.iterator();
       LinearNode node;
       int nodeIdx = 0;
       while(inodes.hasNext()) {
-        node = (LinearNode)inodes.next();
+        node = inodes.next();
         fireStatusChanged(READING + node.toString());
         fireProgressChanged(++nodeIdx * 100 / linesCnt);
         readList(node, true);
@@ -719,5 +724,25 @@
 
     return word;
   } // trunxSuffixVowelsFromWord()
+  
+  @HiddenCreoleParameter
+  @CreoleParameter(comment="not supported by this gazetteer", 
defaultValue="true")
+  public void setCaseSensitive(Boolean newCaseSensitive) {
+    caseSensitive = newCaseSensitive;
+  }
+  
+  @HiddenCreoleParameter
+  @RunTime
+  @CreoleParameter(comment="not supported by this gazetteer", 
defaultValue="true")
+  public void setLongestMatchOnly(Boolean longestMatchOnly) {
+    this.longestMatchOnly = longestMatchOnly;
+  }
+  
+  @HiddenCreoleParameter
+  @RunTime
+  @CreoleParameter(comment="not supported by this gazetteer", 
defaultValue="true")
+  public void setWholeWordsOnly(Boolean wholeWordsOnly) {
+    this.wholeWordsOnly = wholeWordsOnly;
+  }
 
 } // class Russ Gazetteer

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


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to