How StringMetric and Similarity work together
masterThe package uses a StringMetric interface to define how two strings are compared. All specific metrics (like Hamming, Levenshtein, etc.) implement this interface.
You use the strutil.Similarity function to calculate a similarity score between two strings by passing in a StringMetric implementation.
StringMetricinterface: Defines aCompare(a, b string) float64method.strutil.Similarity(a, b string, metric StringMetric) float64: The primary entry point for calculating similarity scores.
type StringMetric interface {
Compare(a, b string) float64
}
func Similarity(a, b string, metric StringMetric) float64 {
}