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
+18.6k Golang : Populate dropdown with html/template example
+10.2k Android Studio : Checkbox for user to select options example
+5.5k Golang : List all packages and search for certain package
+5.1k Golang : Get S3 or CloudFront object or file information
+7.3k Gogland : Where to put source code files in package directory for rookie
+5.3k Swift : Get substring with rangeOfString() function example
+17.6k Golang : Check if a directory exist or not
+12.9k Generate salted password with OpenSSL example
+9.2k Golang : Find correlation coefficient example
+5.8k Golang : Dealing with backquote
+10.2k Golang : Get local time and equivalent time in different time zone
+50.9k Golang : Check if item is in slice/array