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.3k Golang : For loop continue,break and range
+6.4k Golang : Extract sub-strings
+10.9k Golang : Get currencies exchange rates example
+7.1k How to let Facebook Login button redirect to a particular URL ?
+13.9k Golang : Get user input until a command or receive a word to stop
+5k Javascript : How to get width and height of a div?
+12.6k Golang : "https://" not allowed in import path
+7.1k Golang : Normalize email to prevent multiple signups example
+5k Unix/Linux : secure copying between servers with SCP command examples
+7.3k Golang : Gorrila mux.Vars() function example
+9.5k Golang : Terminate-stay-resident or daemonize your program?