jwd

package module
v0.0.0-...-277e4e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 4 Imported by: 0

README

go-jaro-winkler-distance Codeship Status for toldjuuso/go-jaro-winkler-distance GoDoc

Native Jaro-Winkler distance in Go.

Jaro-Winkler distance calculates the familiriaty of two strings on range 0 to 1.

For example comparing words DIXON and DICKSONX gives you score of 0.8133333333333332, whilst comparing words sound and ääni will yield 0.438. That being said, this package also supports unicode characters.

Example
package main

import (
	"fmt"

	"github.com/toldjuuso/go-jaro-winkler-distance"
)

func main() {
	// See more example strings at http://www.amstat.org/sections/srms/Proceedings/papers/1990_056.pdf
	fmt.Println(jwd.Calculate("DIXON", "DICKSONX"))
	// output: 0.8133333333333332
}

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate

func Calculate(s1, s2 string) float64

Calculate calculates Jaro-Winkler distance of two strings. The function lowercases its parameters.

Example
distance := Calculate("jones", "johnson")
fmt.Println(distance)
Output:

0.8323809523809523

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL