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
+4.8k Golang : Extract unicode string from another unicode string example
+8.3k Golang : List available AWS regions
+19.6k Golang : Convert seconds to minutes and remainder seconds
+29.9k Golang : Converting a negative number to positive number
+24.7k Golang : Encrypt and decrypt data with AES crypto
+46.8k Golang : Disable security check for HTTPS(SSL) with bad or expired certificate
+15.4k Golang : Defer function inside init()
+7.3k Golang : How to get username from email address
+9.3k Golang : Characters limiter example
+7.2k Golang : Progress bar with ∎ character
+6.5k Golang : Scan files for certain pattern and rename part of the files
+4.9k Golang : Create new color from command line parameters