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.6k MariaDB/MySQL : How to get version information
+12.6k Golang : zlib compress file example
+5.8k Golang : Shuffle array of list
+20.1k Golang : Check if os.Stdin input data is piped or from terminal
+5.3k Golang : Intercept, inject and replay HTTP traffics from web server
+7.2k Golang : Individual and total number of words counter example
+5.8k Unix/Linux : How to open tar.gz file ?
+30.2k Get client IP Address in Go
+19.8k Golang : How to run your code only once with sync.Once object
+6.3k Golang : Handling image beyond OpenCV video capture boundary
+6.8k Golang : Fibonacci number generator examples
+5.9k Golang : Grab news article text and use NLP to get each paragraph's sentences