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
+87.9k Golang : How to convert character to ASCII and back
+15.2k Golang : Save(pipe) HTTP response into a file
+16.8k Golang : Get own process identifier
+7.9k Golang : Getting Echo framework StartAutoTLS to work
+7.8k Golang : Lock executable to a specific machine with unique hash of the machine
+23.6k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+14k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+47.8k Golang : Convert int to byte array([]byte)
+22.1k Golang : Join arrays or slices example
+12.3k Golang : Display list of countries and ISO codes
+40.5k Golang : Convert to io.ReadSeeker type