https://github.com/ghosind/go-similarity
Similarity or distance metrics for string implemented on Golang, inspired by Sam Chapman's SimMetrics library.
https://github.com/ghosind/go-similarity
distamce-metric go go-library go-package golang similarity similarity-metric string-similarity strings
Last synced: about 1 month ago
JSON representation
Similarity or distance metrics for string implemented on Golang, inspired by Sam Chapman's SimMetrics library.
- Host: GitHub
- URL: https://github.com/ghosind/go-similarity
- Owner: ghosind
- License: mit
- Created: 2023-08-12T05:03:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-30T15:01:22.000Z (5 months ago)
- Last Synced: 2025-02-15T09:46:00.847Z (3 months ago)
- Topics: distamce-metric, go, go-library, go-package, golang, similarity, similarity-metric, string-similarity, strings
- Language: Go
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-similarity

[](https://goreportcard.com/report/github.com/ghosind/go-similarity)
[](https://codecov.io/gh/ghosind/go-similarity)


[](https://pkg.go.dev/github.com/ghosind/go-similarity)Similarity or distance metrics for string implemented on Golang, inspired by [Sam Chapman's SimMetrics library](https://sourceforge.net/projects/simmetrics/).
## Installation
Run the following command to install the package:
```bash
go get -u github.com/ghosind/go-similarity
```## Getting Started
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.
```go
sim := new(similarity.BlockDistance)
similarity := sim.Compare("Hello World", "Hello Go")
fmt.Println(similarity)
// 0.5
```## Supported Metrics Algorithms
- [Block Distance](https://en.wikipedia.org/wiki/Taxicab_geometry)
- Chapman Length Deviation
- Cosine Similarity
- [Dice Coefficient](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient)
- [Euclidean Distance](https://en.wikipedia.org/wiki/Euclidean_distance)
- [Jaccard Coefficient](https://en.wikipedia.org/wiki/Jaccard_index)
- [Levenshtein Distance](https://en.wikipedia.org/wiki/Levenshtein_distance)
- Matching Coefficient
- [Needleman Wunsch](https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm)
- [Overlap Coefficient](https://en.wikipedia.org/wiki/Overlap_coefficient)## Builtin Tokenizers
- Whitespace Tokenizer: Tokenize the input string by whitespace.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.