Documentation
¶
Overview ¶
Package dawg implements a Directed Acyclic Word Graph, with fuzzy search of words in the graph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAWG ¶
type DAWG struct {
// contains filtered or unexported fields
}
DAWG is used to store the representation of the Directly Acyclic Word Graph
func CreateDAWG ¶
Create a new DAWG by loading the words from an array.
func CreateDAWGFromFile ¶
Create a new DAWG by loading the words from a file. The file must be UTF-8 encoded, one word per line.
func LoadDAWGFromFile ¶
Load from a file a DAWG saved by SaveToFile
func (*DAWG) SaveToFile ¶
Save the DAWG to a file, usefull if you want to load it later without re-computing anything
func (*DAWG) Search ¶
func (dawg *DAWG) Search(word string, levenshteinDistance int, maxResults int, allowAdd bool, allowDelete bool) (words []string, err error)
Approximate string searching in the DAWG. levenshteinDistance is the maximum Levenshtein distance allowed beetween word and the words found in the DAWG. maxResults allow to limit the number of returned results (to reduce the time needed by the search) allowAdd and allowDelete specify if the returned words can have insertions/deletions of letters