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
+13k Golang : How to get a user home directory path?
+11.5k Golang : Gorilla web tool kit secure cookie example
+8.1k Swift : Convert (cast) Character to Integer?
+11.8k Golang : Find and draw contours with OpenCV example
+15.4k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+8.8k Golang : Inject/embed Javascript before sending out to browser example
+10.4k Golang : Resolve domain name to IP4 and IP6 addresses.
+18.7k Golang : Delete duplicate items from a slice/array
+10.4k Golang : Select region of interest with mouse click and crop from image
+12.2k Golang : Validate email address
+8.5k Golang : Set or add headers for many or different handlers
+6.9k Web : How to see your website from different countries?