Documentation ¶
Overview ¶
Package synonyms enables mapping synonyms to canonical terms
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter implements the jargon.Filter interface
func NewFilter ¶
func NewFilter(mappings map[string]string, ignoreFuncs ...IgnoreFunc) (*Filter, error)
NewFilter creates a new synonyms filter based on a set of Mappings and IgnoreFuncs. The latter are used to specify insensitivity to case or spaces, for example.
func (*Filter) MaxGramLength ¶
type IgnoreFunc ¶
IgnoreFunc is a function type specifying 'what to ignore' when looking up synonyms.
var IgnoreCase IgnoreFunc = strings.ToLower
IgnoreCase instructs the sysnonyms filter to ignore (be insensitive to) case when looking up synonyms.
var IgnoreSpace IgnoreFunc = Ignore(' ')
IgnoreSpace instructs the synonyms filter to ignore (be insensitive to) spaces when looking up synonyms. Not all whitespace, mind you, but precisely ascii 32.
func Ignore ¶
func Ignore(runes ...rune) IgnoreFunc
Ignore instructs a synonyms filter to ignore (be insensitive to) specific characters when looking up synonyms.