Re: [Snowball-discuss] Name Convention and abstract Method "stem()"

From: Richard Boulton (
Date: Wed Aug 24 2005 - 11:26:42 BST

On Sat, 2005-08-20 at 20:15 +0200, Jens Krefeldt wrote:
> 2. I have an improvement suggestion for the JAVA Snowball Stemmer: If you
> want to use a SnowballStemmer you have to prepare something like this:
> String name = ...;
> Class stemClass = Class.forName("org.tartarus.snowball.ext." +
> name + "Stemmer");
> stemmer = (SnowballProgram) stemClass.newInstance();
> stemMethod = stemClass.getMethod("stem", new Class[0]);
> stemMethod.invoke(stemmer, null);
> My Question: Why doesn't the SnowballProgram class has an abstract stem()
> method like
> public abstract class SnowballProgram {
> ...
> /**
> * Every derived <CODE>SnowballProgram</CODE> has to implement this
> method
> * to initialize the appropiate stem algorithm.
> */
> public abstract boolean stem();
> ...
> }

SnowballProgram represents a general snowball program. Although the
snowball programs presented on are all
stemming algorithms with a single function "stem" as an entry point,
there is no requirement in the snowball language for there to be a
function called stem. It is conceivable that future algorithms might
have more than one entry point, for example.

Therefore, I do not think it's appropriate to add a stem() method to
SnowballProgram. However, the idea is reasonable: it just shouldn't be a
subclass of SnowballProgram.

Actually, what I would like to do is define a new class,
"SnowballStemmer", which is passed the name (or ISO language code) of a
stemming algorithm in its constructor, and has a stem method as you
suggest. This will happen at some point, when I find the time.


This archive was generated by hypermail 2.1.3 : Thu Sep 20 2007 - 12:02:47 BST