Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetStateLimit ¶
func SetStateLimit(v int)
SetStateLimit sets the maximum number of states allowed.
Types ¶
type Levenshtein ¶
type Levenshtein struct {
// contains filtered or unexported fields
}
Levenshtein implements the vellum.Automaton interface for matching terms within the specified Levenshtein edit-distance of the queried term. This automaton recognizes utf-8 encoded bytes and computes the edit distance on the result code-points, not on the raw bytes.
func New ¶
func New(query string, distance int) (*Levenshtein, error)
New creates a new Levenshtein automaton for the specified query string and edit distance.
func (*Levenshtein) Accept ¶
func (l *Levenshtein) Accept(s int, b byte) int
Accept returns the new state, resulting from the transite byte b when currently in the state s.
func (*Levenshtein) CanMatch ¶
func (l *Levenshtein) CanMatch(s int) bool
CanMatch returns if the specified state can ever transition to a matching state.
func (*Levenshtein) IsMatch ¶
func (l *Levenshtein) IsMatch(s int) bool
IsMatch returns if the specified state is a matching state.
func (*Levenshtein) Start ¶
func (l *Levenshtein) Start() int
Start returns the start state of this automaton.
func (*Levenshtein) WillAlwaysMatch ¶
func (l *Levenshtein) WillAlwaysMatch(s int) bool
WillAlwaysMatch returns if the specified state will always end in a matching state.