func Compare(a, b string) float64 {
	a = stripSpaces(a)
	b = stripSpaces(b)
	la, lb := len(a), len(b)
	if a == b {
		return 1.0
	}
	if la < 2 || lb < 2 {
		return 0.0
	}
	firstBigrams := map[string]int{}
	for i := range a[:la-1] {
		bigram := a[i : i+2]
		firstBigrams[bigram]++
	}
	var intersectionSize float64
	for i := range b[:lb-1] {
		bigram := b[i : i+2]
		count := firstBigrams[bigram]
		if count > 0 {
			firstBigrams[bigram] = count - 1
			intersectionSize++
		}
	}
	return 2.0 * intersectionSize / float64(la+lb-2)
}
Compare returns a fraction between 0 and 1, which indicates the degree of
similarity between the two strings. 0 indicates completely different strings,
1 indicates identical strings. The comparison is case-sensitive.
package strsim
import (
	"fmt"
	"sort"
	"strings"
	"unicode"
)