Golang : Fuzzy string search or approximate string matching example
For this tutorial, we will learn how to do a fuzzy search in Golang. Fuzzy search or approximate string matching algorithm is a technique of finding strings that match a pattern approximately. The algorithm is useful to determine a question or sentence intent, sentence auto-complete/suggest and building artificial intelligence chat bot.
Here you go!
package main
import (
"fmt"
"github.com/renstrom/fuzzysearch/fuzzy"
)
func main() {
// find
input := []string{"example", "help", "assistance", "existence"}
fuzzyMatches := fuzzy.Find("ex", input)
fmt.Println("Matches found : ", fuzzyMatches)
}
Happy coding!
References :
See also : Golang : How to check if a string contains another sub-string?
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+10.5k Golang : Convert(cast) uintptr to string example
+7.6k Golang : List available AWS regions
+4.3k Golang : Denco multiplexer example
+3.7k Golang : Detect words using using consecutive letters in a given string
+4.8k CodeIgniter : form input set_value cause " to become & quot
+5.7k Golang : Rename part of filename
+11.6k Golang : Get uploaded file name or access uploaded files
+18.6k Golang : Get password from console input without echo or masked
+13.3k Golang : Get query string value on a POST request
+28.5k Golang : Math pow(the power of x^y) example
+22.3k Golang : Convert uint value to string type
+14.3k Golang : Find file size(disk usage) with filepath.Walk