closestmatch: github.com/schollz/closestmatch Index | Files | Directories

package closestmatch

import "github.com/schollz/closestmatch"

Index

Package Files

closestmatch.go

type ClosestMatch Uses

type ClosestMatch struct {
    SubstringSizes []int
    SubstringToID  map[string]map[uint32]struct{}
    ID             map[uint32]IDInfo
}

ClosestMatch is the structure that contains the substring sizes and carrys a map of the substrings for easy lookup

func Load Uses

func Load(filename string) (*ClosestMatch, error)

Load can load a previously saved ClosestMatch object from disk

func New Uses

func New(possible []string, subsetSize []int) *ClosestMatch

New returns a new structure for performing closest matches

func (*ClosestMatch) AccuracyMutatingLetters Uses

func (cm *ClosestMatch) AccuracyMutatingLetters() float64

AccuracyMutatingLetters runs some basic tests against the wordlist to see how accurate this bag-of-characters method is against the target dataset when mutating individual letters (adding, removing, changing)

func (*ClosestMatch) AccuracyMutatingWords Uses

func (cm *ClosestMatch) AccuracyMutatingWords() float64

AccuracyMutatingWords runs some basic tests against the wordlist to see how accurate this bag-of-characters method is against the target dataset

func (*ClosestMatch) Closest Uses

func (cm *ClosestMatch) Closest(searchWord string) string

Closest searches for the `searchWord` and returns the closest match

func (*ClosestMatch) ClosestN Uses

func (cm *ClosestMatch) ClosestN(searchWord string, max int) []string

ClosestN searches for the `searchWord` and returns the n closests matches

func (*ClosestMatch) Save Uses

func (cm *ClosestMatch) Save(filename string) error

Save writes the current ClosestSave object as a gzipped JSON file

type IDInfo Uses

type IDInfo struct {
    Key           string
    NumSubstrings int
}

IDInfo carries the information about the keys

type Pair Uses

type Pair struct {
    Key   string
    Value int
}

type PairList Uses

type PairList []Pair

func (PairList) Len Uses

func (p PairList) Len() int

func (PairList) Less Uses

func (p PairList) Less(i, j int) bool

func (PairList) Swap Uses

func (p PairList) Swap(i, j int)

Directories

PathSynopsis
cmclient
cmserver
levenshtein
test

Package closestmatch imports 6 packages (graph) and is imported by 7 packages. Updated 2018-05-14. Refresh now. Tools for package owners.