synonyms

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 3 Imported by: 0

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) Lookup

func (f *Filter) Lookup(ss ...string) (string, bool)

func (*Filter) MaxGramLength

func (f *Filter) MaxGramLength() int

type IgnoreFunc

type IgnoreFunc func(string) string

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.

Jump to

Keyboard shortcuts

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