Categorygithub.com/masatana/go-textdistance
modulepackage
0.0.0-20191005053614-738b0edac985
Repository: https://github.com/masatana/go-textdistance.git
Documentation: pkg.go.dev

# README

go-textdistance

Calculate various text distance with golang.

codecov

Implemented

How to Use

$ go get github.com/masatana/go-textdistance
package main

import (
	"fmt"

	"github.com/masatana/go-textdistance"
)

func main() {
	s1 := "this is a test"
	s2 := "that is a test"
	fmt.Println(textdistance.LevenshteinDistance(s1, s2))
	fmt.Println(textdistance.DamerauLevenshteinDistance(s1, s2))
	fmt.Println(textdistance.JaroDistance(s1, s2))
	fmt.Println(textdistance.JaroWinklerDistance(s1, s2))
}

How to test

$ go test
PASS
ok      github.com/masatana/go-textdistance     0.002s

License

This software is released under the MIT License, see LICENSE.txt.

# Functions

DamerauLevenshteinDistance calculates the damerau-levenshtein distance between s1 and s2.
JaccardSimilarity, as known as the Jaccard Index, compares the similarity of sample sets.
JaroDistance calculates jaro distance between s1 and s2.
JaroWinklerDistance calculates jaro-winkler distance between s1 and s2.
LevenshteinDistance calculates the levenshtein distance between s1 and s2.
Max returns the maximum number of passed int slices.
Min returns the minimum number of passed int slices.