Tried a number of alternative approaches, but for example put snowball-20051019.jar in lib\weka\packages*.jar and re-ran ikvmc. This puts stemmers in the same weka.dll with everything else.
Although code like this succeeds
let found = java.lang.Class.forName("org.tartarus.snowball.ext.porterStemmer")
The "discovery" code used by the stemmers fails, e.g.
let goe = weka.gui.GenericObjectEditor.getClassnames("org.tartarus.snowball.SnowballProgram");
let cd = weka.core.ClassDiscovery.find("org.tartarus.snowball.SnowballProgram","org.tartarus.snowball.ext")
Discover nothing. It seems that no plugins are being loaded for GOE.
Any suggestion on how to make this work properly?
For the curious, here is a workaround that uses reflection:
//lets us set a private property in general
let dynamicSet x propName propValue =
let property = x.GetType().GetField(propName, BindingFlags.Static ||| BindingFlags.FlattenHierarchy ||| BindingFlags.Instance ||| BindingFlags.NonPublic ||| BindingFlags.Public)
property.SetValue(x, propValue)
//get a stemmer wrapper; it won't find any implementations by default
let stemmer = new weka.core.stemmers.SnowballStemmer();
//in its init function, the stemmer should have populated a list of available stemmers. We do that manually.
let options = new java.util.Vector()
options.add("porter") |> ignore
//use reflection to set the private list of available stemmers
dynamicSet stemmer "m_Stemmers" options
//setstemmer checks this list, and if it finds "porter", connects the wrapper to the implementation
stemmer.setStemmer("porter");
Tried a number of alternative approaches, but for example put snowball-20051019.jar in lib\weka\packages*.jar and re-ran ikvmc. This puts stemmers in the same weka.dll with everything else.
Although code like this succeeds
let found = java.lang.Class.forName("org.tartarus.snowball.ext.porterStemmer")
The "discovery" code used by the stemmers fails, e.g.
let goe = weka.gui.GenericObjectEditor.getClassnames("org.tartarus.snowball.SnowballProgram");
let cd = weka.core.ClassDiscovery.find("org.tartarus.snowball.SnowballProgram","org.tartarus.snowball.ext")
Discover nothing. It seems that no plugins are being loaded for GOE.
Any suggestion on how to make this work properly?
For the curious, here is a workaround that uses reflection:
//lets us set a private property in general
let dynamicSet x propName propValue =
let property = x.GetType().GetField(propName, BindingFlags.Static ||| BindingFlags.FlattenHierarchy ||| BindingFlags.Instance ||| BindingFlags.NonPublic ||| BindingFlags.Public)
property.SetValue(x, propValue)
//get a stemmer wrapper; it won't find any implementations by default
let stemmer = new weka.core.stemmers.SnowballStemmer();
//in its init function, the stemmer should have populated a list of available stemmers. We do that manually.
let options = new java.util.Vector()
options.add("porter") |> ignore
//use reflection to set the private list of available stemmers
dynamicSet stemmer "m_Stemmers" options
//setstemmer checks this list, and if it finds "porter", connects the wrapper to the implementation
stemmer.setStemmer("porter");