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
+8k Golang : Reverse text lines or flip line order example
+18.2k Golang : Send email with attachment
+8.9k Golang : Gonum standard normal random numbers example
+8.7k Golang : How to capture return values from goroutines?
+29.9k Golang : How to verify uploaded file is image or allowed file types
+11.8k Golang : Pagination with go-paginator configuration example
+12.7k Golang : Convert(cast) uintptr to string example
+3.4k Golang : Switch Redis database redis.NewClient
+8.4k Golang : How to join strings?
+16.5k Golang : Get own process identifier
+17.3k How to enable MariaDB/MySQL logs ?
+10.2k Swift : Convert (cast) String to Integer