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
+21.1k PHP : Convert(cast) int to double/float
+9.8k Golang : Populate slice with sequential integers example
+19.5k Golang : Get host name or domain name from IP address
+12.4k Golang : Get month name from date example
+22.8k Golang : Strings to lowercase and uppercase example
+12.5k Golang : Encrypt and decrypt data with x509 crypto
+12.3k Golang : Find and draw contours with OpenCV example
+8.2k Golang : Get all countries phone codes
+13.6k Golang : Get constant name from value
+16.6k Golang : Execute terminal command to remote machine example
+26.8k Golang : Encrypt and decrypt data with AES crypto
+10k Golang : Sort and reverse sort a slice of integers