Help us shape the future of Go! Take the 2026 Go Developer Survey

ptstemmer

package module
v0.0.0-...-a20158d Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2013 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Portuguese stemmer for Go

This package contains a Porter stemmer implementation for Portuguese.

Installing

To install ptstemmer run:

go get github.com/tncardoso/ptstemmer

Usage Example

package main

import (
    "fmt"
    "github.com/tncardoso/ptstemmer"
)

func main() {
    // Porter stemmer implements Stemmer interface
    var stemmer ptstemmer.Stemmer = ptstemmer.NewPorterStemmer()

    words := []string {
        "ajudar",
        "ajudei",
        "ajudou",
        "ajuda",
    }   

    for _, w := range words {
        fmt.Printf("word= %s stem= %s\n", w, stemmer.Stem(w))
    }   
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PorterStemmer

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

PorterStemmer implements the Porter stemming algorithm for the portuguese language. The implementation was based in the following implementation: http://snowball.tartarus.org/algorithms/portuguese/stemmer.html

func NewPorterStemmer

func NewPorterStemmer() *PorterStemmer

Create Porter stemmer struct. Vowels and necessary suffixes for the algorithm are also loaded in this step.

func (*PorterStemmer) Stem

func (ps *PorterStemmer) Stem(word string) string

Stem executes all steps necessary to obtain a given word's stem. This function is used for portuguese stemming only.

type Stemmer

type Stemmer interface {
	Stem(word string) string
}

Stemmers should implement the Stemmer interface. A stemmer should be able to, given a word, return its stem in a deterministic way.

Jump to

Keyboard shortcuts

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