Revision: 17106
          http://sourceforge.net/p/gate/code/17106
Author:   valyt
Date:     2013-11-19 14:41:54 +0000 (Tue, 19 Nov 2013)
Log Message:
-----------
- added IVY dependency resolution to th e creole.xml file.
- fixed feature counting from 1 (as per LIBLINEAR spec, as opposed to LibSVM).

The categorizer works!

Modified Paths:
--------------
    gate/trunk/plugins/Text_Categorization/creole.xml
    
gate/trunk/plugins/Text_Categorization/src/gate/ml/categorization/TextCategorizationPR.java

Modified: gate/trunk/plugins/Text_Categorization/creole.xml
===================================================================
--- gate/trunk/plugins/Text_Categorization/creole.xml   2013-11-19 12:27:16 UTC 
(rev 17105)
+++ gate/trunk/plugins/Text_Categorization/creole.xml   2013-11-19 14:41:54 UTC 
(rev 17106)
@@ -2,4 +2,5 @@
 <!-- $Id: creole.xml 11850 2009-10-30 15:22:04Z ian_roberts $ -->
 <CREOLE-DIRECTORY>
   <JAR SCAN="true">textCategorization.jar</JAR>
+  <IVY>build/ivy.xml</IVY>
 </CREOLE-DIRECTORY>

Modified: 
gate/trunk/plugins/Text_Categorization/src/gate/ml/categorization/TextCategorizationPR.java
===================================================================
--- 
gate/trunk/plugins/Text_Categorization/src/gate/ml/categorization/TextCategorizationPR.java
 2013-11-19 12:27:16 UTC (rev 17105)
+++ 
gate/trunk/plugins/Text_Categorization/src/gate/ml/categorization/TextCategorizationPR.java
 2013-11-19 14:41:54 UTC (rev 17106)
@@ -36,6 +36,7 @@
 import gate.creole.ResourceInstantiationException;
 import gate.creole.metadata.CreoleParameter;
 import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
 import gate.creole.metadata.RunTime;
 
 import java.io.BufferedInputStream;
@@ -385,7 +386,8 @@
         // classify the vector
         Feature[] features = new Feature[libLinearModel.getNrFeature()];
         for(int i = 0; i <  features.length; i++) {
-          features[i] = new FeatureNode(i, instanceVector.get(i));
+          // in liblinear, features start from 1, hence the "i + 1" below
+          features[i] = new FeatureNode(i + 1, instanceVector.get(i));
         }
         double[] probs = new double[libLinearModel.getNrClass()];
         // the value returned is always an int. Returned as a double because
@@ -581,6 +583,7 @@
    */
   @CreoleParameter(
       comment = "URL to a file containing stop words, one on each line, using 
UTF-8.")
+  @Optional
   public void setStopWordsURL(URL stopWordsURL) {
     this.stopWordsURL = stopWordsURL;
   }

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


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to