Cosine similarity quantifies the resemblance between two vectors in a multi-dimensional setting, often applied to gauge the similarity between textual entities. Conceptually, it evaluates the angle between the directions these vectors point towards, indicating their similarity. When this angle is minimal, approaching zero degrees, the cosine value tends toward 1, denoting a stronger alignment and thus higher textual similarity.
go get github.com/omgupta1608/cosine_similarity
import (
"fmt"
cs "github.com/omgupta1608/cosine_similarity"
)
func main() {
a := "Who are you?"
b := "Who is that?"
score := cs.Cosine(a, b)
fmt.Println("Score: ", score)
}
Score: 0.5773502691896258