snowball

package module
v0.0.0-...-0eb218b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2014 License: MIT Imports: 4 Imported by: 0

README

Stemmer

This is a mirror of the snowball stemmer bindings for Go from bitbucket.org/tebeka/snowball by Miki Tebeka. The mirror was made on 2014-07-25, with the last update by Miki on 2013-07-03. I have copied it here so I don't lose it, just in case, since it is very useful for my own Go Classifier. I've also added clearer usage instructions in this readme to make it easier to understand the usage.

Installation

This isn't the only set of C bindings for Go around, but I like this version because it includes all of the C files in the package. No messing around. You can import it with:

go get github.com/AlasdairF/Stemmer

or

go get bitbucket.org/tebeka/snowball

Stemmer Languages Included

danish
dutch
english
finnish
french
german
hungarian
italian
norwegian
porter
portuguese
romanian
russian
spanish
swedish
turkish

Note that porter is an older version of the english stemmer. You should use english instead.

Usage

Note that the strings you are stemming must not be in CAPITALS, though it is OK if the first letter is Capitalized. Only strings are accepted, not []byte.

english, err := snowball.New(`english`)
if err!=nil {
    panic(err)
}
w := english.Stem(`testing`)
fmt.Println(`testing =`,w)
// testing = test

Original Readme

Snowball Stemmer for Go.

For bugs, comments, sources and more - head over to https://bitbucket.org/tebeka/snowball.

Miki Tebeka

Documentation

Overview

snowball stemmer

Example:

stemmer = snowball.New("english")
fmt.Println(stemmer.stem("running")) // Will print "run"

Index

Constants

View Source
const (
	Version = "0.2.0"
)

Variables

This section is empty.

Functions

func LangList

func LangList() []string

LangList returns the list of languages supported by snowball

Types

type Stemmer

type Stemmer struct {
	// contains filtered or unexported fields
}

Stemmer structure

func New

func New(lang string) (*Stemmer, error)

New creates a new stemmer for lang

func (*Stemmer) Lang

func (stmr *Stemmer) Lang() string

Lang return the stemmer language

func (*Stemmer) Stem

func (stmr *Stemmer) Stem(word string) string

Stem returns them stem of word (e.g. running -> run)

Directories

Path Synopsis
Example on using Snowball stemmer This program will read a file, then print "word -> stem(word)" for every word in file
Example on using Snowball stemmer This program will read a file, then print "word -> stem(word)" for every word in file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL