{"id":13411694,"url":"https://github.com/agext/levenshtein","last_synced_at":"2025-03-14T17:31:02.314Z","repository":{"id":56819893,"uuid":"55736685","full_name":"agext/levenshtein","owner":"agext","description":"Levenshtein distance and similarity metrics with customizable edit costs and Winkler-like bonus for common prefix.","archived":false,"fork":false,"pushed_at":"2020-10-15T13:29:05.000Z","size":24,"stargazers_count":85,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:48:38.104Z","etag":null,"topics":["awesome-go","common-prefix-bonus","edit-costs","levenshtein","levenshtein-distance","similarity-metric","string-distance","string-pairs","string-similarity","winkler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-08T00:14:31.000Z","updated_at":"2024-07-05T08:34:15.000Z","dependencies_parsed_at":"2022-09-26T19:01:53.212Z","dependency_job_id":null,"html_url":"https://github.com/agext/levenshtein","commit_stats":null,"previous_names":["agext/lev"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agext%2Flevenshtein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agext%2Flevenshtein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agext%2Flevenshtein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agext%2Flevenshtein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agext","download_url":"https://codeload.github.com/agext/levenshtein/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618656,"owners_count":20320272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["awesome-go","common-prefix-bonus","edit-costs","levenshtein","levenshtein-distance","similarity-metric","string-distance","string-pairs","string-similarity","winkler"],"created_at":"2024-07-30T20:01:15.865Z","updated_at":"2025-03-14T17:31:01.972Z","avatar_url":"https://github.com/agext.png","language":"Go","funding_links":[],"categories":["Data Structures and Algorithms","数据结构与算法","Go","Data Structures","数据结构`go语言实现的数据结构与算法`","Uncategorized","数据结构","Data Integration Frameworks","\u003cspan id=\"数据结构-data-structures\"\u003e数据结构 Data Structures\u003c/span\u003e","數據結構","Generators"],"sub_categories":["Text Analysis","文本分析","Advanced Console UIs","标准 CLI","高级控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高級控制台界面"],"readme":"# A Go package for calculating the Levenshtein distance between two strings\n\n[![Release](https://img.shields.io/github/release/agext/levenshtein.svg?style=flat)](https://github.com/agext/levenshtein/releases/latest)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/agext/levenshtein) \n[![Build Status](https://travis-ci.org/agext/levenshtein.svg?branch=master\u0026style=flat)](https://travis-ci.org/agext/levenshtein)\n[![Coverage Status](https://coveralls.io/repos/github/agext/levenshtein/badge.svg?style=flat)](https://coveralls.io/github/agext/levenshtein)\n[![Go Report Card](https://goreportcard.com/badge/github.com/agext/levenshtein?style=flat)](https://goreportcard.com/report/github.com/agext/levenshtein)\n\n\nThis package implements distance and similarity metrics for strings, based on the Levenshtein measure, in [Go](http://golang.org).\n\n## Project Status\n\nv1.2.3 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on \"AS IS\" basis.\n\nThis package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome.\n\n## Overview\n\nThe Levenshtein `Distance` between two strings is the minimum total cost of edits that would convert the first string into the second. The allowed edit operations are insertions, deletions, and substitutions, all at character (one UTF-8 code point) level. Each operation has a default cost of 1, but each can be assigned its own cost equal to or greater than 0.\n\nA `Distance` of 0 means the two strings are identical, and the higher the value the more different the strings. Since in practice we are interested in finding if the two strings are \"close enough\", it often does not make sense to continue the calculation once the result is mathematically guaranteed to exceed a desired threshold. Providing this value to the `Distance` function allows it to take a shortcut and return a lower bound instead of an exact cost when the threshold is exceeded.\n\nThe `Similarity` function calculates the distance, then converts it into a normalized metric within the range 0..1, with 1 meaning the strings are identical, and 0 that they have nothing in common. A minimum similarity threshold can be provided to speed up the calculation of the metric for strings that are far too dissimilar for the purpose at hand. All values under this threshold are rounded down to 0.\n\nThe `Match` function provides a similarity metric, with the same range and meaning as `Similarity`, but with a bonus for string pairs that share a common prefix and have a similarity above a \"bonus threshold\". It uses the same method as proposed by Winkler for the Jaro distance, and the reasoning behind it is that these string pairs are very likely spelling variations or errors, and they are more closely linked than the edit distance alone would suggest.\n\nThe underlying `Calculate` function is also exported, to allow the building of other derivative metrics, if needed.\n\n## Installation\n\n```\ngo get github.com/agext/levenshtein\n```\n\n## License\n\nPackage levenshtein is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagext%2Flevenshtein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagext%2Flevenshtein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagext%2Flevenshtein/lists"}