Giter Site home page Giter Site logo

go-fuzzywuzzy's Introduction

go-fuzzywuzzy

This is a port of SeatGeek's fuzzywuzzy, a fuzzy string matching library.

Usage

Levenshtein Edit Distance

fuzzy.EditDistance("bart", "bort")
1

Simple Ratio

fuzzy.Ratio("coolstring", "coooolstring")
91
fuzzy.Ratio("coolstring", "radstring"))
63

Partial Ratio

fuzzy.Ratio("needle", "haystackneedelhaystack")
36
fuzzy.PartialRatio("needle", "haystackneedelhaystack")
83

Token Sort Ratio

fuzzy.Ratio("several tokens arbitrary order", "order arbitrary several tokens")
50
fuzzy.TokenSortRatio("several tokens arbitrary order", "order arbitrary several tokens")
100

Token Set Ratio

fuzzy.TokenSortRatio("several tokens arbitrary order", "order order arbitrary several tokens")
91
fuzzy.TokenSetRatio("several tokens arbitrary order", "order order arbitrary several tokens")
100

Process

choices := []string{"Wayne Shorter", "Jonathan Richman", "Wayne Hancock", "Kate Bush"}
fuzzy.ExtractOne("wayne hancock", choices)
{Match:"Wayne Hancock", Score:100}
fuzzy.Extract("wayne hancock", choices, 2)
[{Match:"Wayne Hancock", Score:100}, {Match:"Wayne Shorter", Score:62}]

go-fuzzywuzzy's People

Contributors

paul-mannino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

go-fuzzywuzzy's Issues

Can we use goroutine

When I have to find the best 50 with accepted match score 70, with 22k choices taking 2s,
It's too high
Using goroutines can we optimize it further or parallel computing?
Please suggest me possible solution.

fuzzy.Ratio() returning 100 when not exact match

Differing results between this package and python package. In this case, whenever one number is different, it still returns 100. If a letter is different, it appears to work fine:

package main

import "fmt"
import "github.com/paul-mannino/go-fuzzywuzzy"

func main(){
    a := "JOHNSMITH6211986"
    b := "JOHNSMITH6201986"
    r := fuzzy.Ratio(a,b)
    //expect 94, but get 100
    fmt.Println(r)
}
from fuzzywuzzy import fuzz

a = "JOHNSMITH6211986"
b = "JOHNSMITH6201986"
#get 94
fuzz.ratio(a,b)

请问中文调用fuzzy.ExtractOne匹配score都为0.有什么参数设置么?

choices := []string{"芯姐好工作(聘)", "芯姐好工作", "还能不能工作好了"}
ans,_ :=fuzzy.ExtractOne("芯姐好工作", choices)
fmt.Println("ans",ans)

{芯姐好工作(聘) 0}
{芯姐好工作 0}
{还能不能工作好了 0}
matches [0xc00011c040 0xc00011c060 0xc00011c080]
ans &{芯姐好工作(聘) 0}

this package does not support rtl language

i have tried this example but does not worked for me

package main

import (
	"fmt"

	fuzzy "github.com/paul-mannino/go-fuzzywuzzy"
)

func main() {
	choices := []string{"طماطة", "Jonathan Richman", "Wayne Hanock", "Kate Bush"}

	// words := []string{"geek", "gfg", "wh", "wl"}

	fmt.Println(fuzzy.ExtractOne("طماطة", choices))

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.