Stemmer package provides an interface for stemmers and includes English, German and Dutch stemmers as sub-packages:
-
porter2
sub-package implements English (Porter2) stemmer as described in https://snowball.tartarus.org/algorithms/english/stemmer.html -
german
sub-package implements German stemmer as described in https://snowball.tartarus.org/algorithms/german/stemmer.html -
dutch
sub-package implements Dutch stemmer as described in https://snowball.tartarus.org/algorithms/dutch/stemmer.html
English stemmer:
go get github.com/dchest/stemmer/porter2
German stemmer:
go get github.com/dchest/stemmer/german
Dutch stemmer:
go get github.com/dchest/stemmer/dutch
This will also install the top-level stemmer
package.
import (
"github.com/dchest/stemmer/porter2"
"github.com/dchest/stemmer/german"
"github.com/dchest/stemmer/dutch"
)
// English.
eng := porter2.Stemmer
eng.Stem("delicious") // => delici
eng.Stem("deliciously") // => delici
// German.
ger := german.Stemmer
ger.Stem("abhängen") // => abhang
ger.Stem("abhängiger") // => abhang
// Dutch.
dt := dutch.Stemmer
dt.Stem("lichamelijke") // => licham
dt.Stem("opglimpende") // => opglimp
Included test_output.txt
and test_voc.txt
are from the referenced original
implementations, used only when running tests with go test
.
2-clause BSD-like (see LICENSE and AUTHORS files).