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
+4k Javascript : Empty an array example
+11.8k Golang : Sort and reverse sort a slice of runes
+7.3k SSL : How to check if current certificate is sha1 or sha2 from command line
+15.3k Golang : Validate hostname
+6.6k Golang : Calculate pivot points for a cross
+41.3k Golang : How do I convert int to uint8?
+4.6k Fix Google Analytics Redundant Hostnames problem
+5.6k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+16.6k Golang : Get the IPv4 and IPv6 addresses for a specific network interface
+15k Golang : Accurate and reliable decimal calculations
+10.5k Android Studio : Checkbox for user to select options example
+15.8k Golang : Get sub string example