rslp

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 5 Imported by: 0

README

Algorítmo para remoção de sufixos

Baseado neste artigo de Alexandre R. Coelho.

graph TD
    A(Início)
    A --> X{Termina<br>em 's'?}
    X --> |Sim| B(Redução do Plural)
    X --> |Não| C(Redução Adverbial)
    B --> C
    C --> Y{Termina<br>em 'a'?}
    Y --> |Sim| D(Redução do Feminino)
    Y --> |Não| E(Redução do Aumentativo)
    D --> E
    E --> F(Redução Nominal)
    F --> W{Sufixo<br>removido?}
    W --> |Sim| L(Remoção de Acentuação)
    W --> |Não| G(Redução Verbal)
    G --> Z{Sufixo<br>removido?}
    Z --> |Sim| H(Remoção de Vogais Temáticas)
    Z --> |Não| L
    H --> L
    L --> M(Fim)

Uso

Palavra(term string) string

Para converter uma palavra: Palavra("normais") => "norm"

Frase(doc string) string

Para conveter uma frase: Frase("Ajuste a Valor Justo - Investimentos") => "ajust val just invest"

Documentation

Index

Constants

View Source
const (
	Plural ruletype = iota + 1
	Advérbio
	Feminino
	Aumentantivo
	Substantivo
	Verbo
	Vogal
)

Variables

This section is empty.

Functions

func Frase added in v0.0.2

func Frase(doc string) string

func Palavra added in v0.0.2

func Palavra(term string) string

Types

type Rule

type Rule struct {
	Name        ruletype
	MinWordSize int
	WithSuffix  bool
	Suffixes    []string
	SubRules    []SubRule
}

type SubRule

type SubRule struct {
	Suffix     string
	StemSize   int
	Replace    string
	Exceptions []string
}

Jump to

Keyboard shortcuts

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