Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Integrating Stemmers #1

@aolney

Description

@aolney

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions