Similarity or distance metrics for string implemented on Golang, inspired by Sam Chapman's SimMetrics library.
Run the following command to install the package:
go get -u github.com/ghosind/go-similarity
To use the similarity package, you need to import it in your Go file and create a new instance of the similarity you want to use.
sim := new(similarity.BlockDistance)
similarity := sim.Compare("Hello World", "Hello Go")
fmt.Println(similarity)
// 0.5
- Block Distance
- Chapman Length Deviation
- Cosine Similarity
- Dice Coefficient
- Euclidean Distance
- Jaccard Coefficient
- Levenshtein Distance
- Matching Coefficient
- Needleman Wunsch
- Overlap Coefficient
- Whitespace Tokenizer: Tokenize the input string by whitespace.
This project is licensed under the MIT License - see the LICENSE file for details.