Created
April 25, 2016 15:59
-
-
Save lmas/0d19e98636459eb1bf82759223abbdf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package leven | |
import "github.com/arbovm/levenshtein" | |
func calcScore(a, b string) float64 { | |
score := levenshtein.Distance(a, b) | |
lena := len(a) | |
lenb := len(b) | |
var bigger float64 | |
if lena > lenb { | |
bigger = float64(lena) | |
} else { | |
bigger = float64(lenb) | |
} | |
return (bigger - float64(score)) / bigger | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment