Documentation
¶
Overview ¶
Package trigram provides string indexing and matching.
Example ¶
package main import ( "fmt" "dasa.cc/x/trigram" ) func main() { terms := []string{"the quick", "red fox", "jumps over", "the lazy", "brown dog"} var gs trigram.Set gs.Index(terms...) var m []string var u []float64 m, u = gs.Match("bog", 0.33) // mispelled "dog" for i, s := range m { fmt.Printf("%.2f: %q\n", u[i], s) } m, u = gs.Match("the", 0.33) for i, s := range m { fmt.Printf("%.2f: %q\n", u[i], s) } }
Output: 0.50: "brown dog" 1.00: "the lazy" 1.00: "the quick"
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSpaceDigitLetterToLower ¶
IsSpaceDigitLetterToLower reports whether rune is a letter, digit, or space character as defined by Unicode's White Space property and maps rune to lower case.
Types ¶
type Set ¶
type Set struct { // Mapping function used when calling Parse // or defaults to IsSpaceDigitLetterToLower if not set. Mapping func(rune) rune // Fields function used when calling Parse // or defaults to unicode.IsSpace if not set. Fields func(rune) bool // contains filtered or unexported fields }
Set indexer; zero value is valid.
Click to show internal directories.
Click to hide internal directories.