sc0Vu / didyoumean

Didyoumean in golang (Levenshtein distance)

Home Page:https://godoc.org/github.com/sc0Vu/didyoumean

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

didyoumean

Go Go Report Card

Didyoumean written in golang, find the similar string from the given string list. Currently it use Levenshtein distance to calculate edit distannce between two strings. See: https://en.wikipedia.org/wiki/Levenshtein_distance

Installation

$ go get https://github.com/sc0vu/didyoumean

or you can

import (
    "https://github.com/sc0vu/didyoumean"
)

Usage

Parameters

ThresholdRate float64

ThresholdRate is the rate that allows the edit distanse less than, eg 0.4 means the edit distance less than 40%

CaseInsensitive bool

CaseInsensitive compare the edit distance in case insensitive mode

FirstMatch

Find first match of the given string list

didyoumean.FirstMatch("key", []string{"kkk", "apple", "kea"})

Match

Find all match of the given string list

didyoumean.Match("key", []string{"kkk", "apple", "kea"})

License

MIT

About

Didyoumean in golang (Levenshtein distance)

https://godoc.org/github.com/sc0Vu/didyoumean

License:MIT License


Languages

Language:Go 94.0%Language:Makefile 6.0%