Go implementation of Kondrak N-SIM and N-DIST (SPIRE 2005). Built for Watchman token scoring.
import "github.com/PhonoGrams/ngram"
ngram.Similarity("toradol", "tegretol") // N-SIM, n=2 (BI-SIM)
ngram.NSim("cycloserine", "cyclosporine", 3)
ngram.NDist("precede", "preceed", 2)First-letter affixing (the first character is repeated n-1 times). Positional n-gram credit is the fraction of matching character positions.
- Kondrak, N-Gram Similarity and Distance, SPIRE 2005
- Watchman: moov-io/watchman#882
Apache License 2.0