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
+6.1k Golang : Find the shortest line of text example
+11.3k Golang : List running EC2 instances and descriptions
+6.5k Golang : Trim everything onward after a word
+11.8k Golang : Transform comma separated string to slice example
+9.5k Generate Random number with math/rand in Go
+9.2k Golang : Use regular expression to get all upper case or lower case characters example
+18.5k Golang : Example for DSA(Digital Signature Algorithm) package functions
+31k Golang : Validate email address with regular expression
+8.6k Golang : Qt Yes No and Quit message box example
+6k Default cipher that OpenSSL used to encrypt a PEM file
+5.8k Unix/Linux : How to get own IP address ?
+9k Golang : Identifying Golang HTTP client request