levenshtein

package
v0.0.0-...-b15db8c Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

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.

func StateLimit

func StateLimit() int

StateLimit is 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.

Jump to

Keyboard shortcuts

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