Esempio n. 1
0
func Example() {
	s1 := "kitten"
	s2 := "sitting"
	distance, err := levenshtein.ComputeDistance(s1, s2)
	if err != nil {
		// handle error
	}
	fmt.Printf("The distance between %s and %s is %d.\n", s1, s2, distance)
	// Output:
	// The distance between kitten and sitting is 3.
}
Esempio n. 2
0
func dist(a, b string) int {
	a = Normalize(a)
	b = Normalize(b)
	d, _ := levenshtein.ComputeDistance(a, b) //this never actually returns an error
	return d
}