[Snowball-discuss] bug in the java version: "cannot be cast to org.tartarus.snowball.SnowballStemmer"

Olly Betts olly at survex.com
Tue Mar 15 20:59:35 GMT 2016


On Tue, Mar 15, 2016 at 08:14:17PM +0000, Luangsay Sourygna wrote:
> As a workaround, I do a quick sed on the generated java class. In my case:
> sed -i
> "s/org.tartarus.snowball.SnowballProgram/org.tartarus.snowball.SnowballStemmer/"
> java/org/tartarus/snowball/ext/DutchKraaijPohlmannStemmer.java

There's no need to post-process like this - you can specify the parent
class to inherit from by using -p when you run the snowball compiler -
e.g. 

  -p org.tartarus.snowball.SnowballStemmer

> (by default my generated class
> extends org.tartarus.snowball.SnowballProgram. And it seems like it should
> extend org.tartarus.snowball.SnowballStemmer instead).

I think the idea behind this design was that snowball is a
general-purpose string processing language, and SnowballProgram
encapsulates that, while SnowballStemmer encapsulates the use of it to
implement stemming algorithms.

In practice, I'm not aware of anyone who actually uses snowball for
anything else, making the distinction somewhat moot, and the default
behaviour arguably a bit unhelpful.

Cheers,
    Olly



More information about the Snowball-discuss mailing list