{"id":15002476,"url":"https://github.com/danharltey/fastenshtein","last_synced_at":"2025-05-14T18:06:14.832Z","repository":{"id":51413551,"uuid":"46226892","full_name":"DanHarltey/Fastenshtein","owner":"DanHarltey","description":"The fastest .Net Levenshtein around","archived":false,"fork":false,"pushed_at":"2025-02-12T19:08:32.000Z","size":169,"stargazers_count":263,"open_issues_count":5,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-10T23:34:52.210Z","etag":null,"topics":["csharp","fastenshtein","fuzzy-matching","levenshtein","sql-server"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanHarltey.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-15T17:00:34.000Z","updated_at":"2025-04-02T02:05:25.000Z","dependencies_parsed_at":"2024-01-22T12:48:36.358Z","dependency_job_id":"87ca217a-e884-4235-bebb-5397969cb9fc","html_url":"https://github.com/DanHarltey/Fastenshtein","commit_stats":{"total_commits":85,"total_committers":7,"mean_commits":"12.142857142857142","dds":"0.49411764705882355","last_synced_commit":"d08afda4330ae0340fb2f16e7f6a274321807d7d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanHarltey%2FFastenshtein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanHarltey%2FFastenshtein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanHarltey%2FFastenshtein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanHarltey%2FFastenshtein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanHarltey","download_url":"https://codeload.github.com/DanHarltey/Fastenshtein/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030965,"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":["csharp","fastenshtein","fuzzy-matching","levenshtein","sql-server"],"created_at":"2024-09-24T18:50:38.334Z","updated_at":"2025-05-14T18:06:09.823Z","avatar_url":"https://github.com/DanHarltey.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastenshtein\n[![NuGet](https://img.shields.io/nuget/v/Fastenshtein.svg)](https://www.nuget.org/packages/Fastenshtein/) [![GitHub action build](https://github.com/DanHarltey/Fastenshtein/actions/workflows/main-build.yml/badge.svg?branch=master)](https://github.com/DanHarltey/Fastenshtein/actions/workflows/main-build.yml) [![AppVeyor Build](https://ci.appveyor.com/api/projects/status/my7qghoen4pofb3h?svg=true)](https://ci.appveyor.com/project/DanHarltey/fastenshtein) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Unit test coverage](https://coveralls.io/repos/github/DanHarltey/Fastenshtein/badge.svg?branch=master)](https://coveralls.io/github/DanHarltey/Fastenshtein?branch=master)\n\nOne of the fastest .Net Levenshtein projects around.\n\nFastenshtein is an optimized and fully unit tested Levenshtein implementation. It is optimized for speed and memory usage.\n\nFrom the included brenchmarking tests comparing random words of 3 to 20 random chars to other Nuget Levenshtein implementations.\n\n| Method                  | Mean     | Ratio | Rank | Gen0     | Allocated  | Alloc Ratio |\n|------------------------ |---------:|------:|-----:|---------:|-----------:|------------:|\n| Fastenshtein            | 1.077 ms |  1.00 |    1 |        - |     6345 B |       1.000 |\n| FastenshteinStatic      | 1.122 ms |  1.04 |    2 |   3.9063 |   265441 B |      41.835 |\n| NinjaNye                | 1.899 ms |  1.76 |    4 |  76.1719 |  4274593 B |     673.695 |\n| StringSimilarity        | 2.899 ms |  2.69 |    5 |   7.8125 |   543770 B |      85.701 |\n| FuzzyStringsNetStandard | 7.351 ms |  6.81 |    6 | 414.0625 | 22967283 B |   3,619.745 |\n\n## Usage\n\n```cs\nint levenshteinDistance = Fastenshtein.Levenshtein.Distance(\"value1\", \"value2\");\n```\nAlternative method for comparing one item against many (quicker due to less memory allocation, not thread safe)\n```cs\nFastenshtein.Levenshtein lev = new Fastenshtein.Levenshtein(\"value1\");\nforeach (var item in new []{ \"value2\", \"value3\", \"value4\"})\n{\n\tint levenshteinDistance = lev.DistanceFrom(item);\n}\n```\n### How to include Fastenshtein in Microsoft SQL Server (SQLCLR)\n\nWe will create Fastenshtein as a CLR Scalar-Valued Function within SQL Server. This will allow the fast Levenshtein implementationto be used within SQL Server.\n\n1. To enable CLR integration for the server:\n```sql\nsp_configure 'clr enabled', 1\nRECONFIGURE\n```\n2. Beginning with SQL Server 2017 (14.x). Either configure [CLR strict security](https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/clr-strict-security?view=sql-server-ver15) or run the below to disable it.\n```sql\nEXEC sp_configure 'show advanced options', 1;\nRECONFIGURE;\n\nEXEC sp_configure 'clr strict security', 0;\nRECONFIGURE;\n```\n\n3. Place the Fastenshtein.dll on the same computer as the SQL Server instance in a directory that the SQL Server instance has access to. You must use the .Net framework version 4.5.2 of Fastenshtein. To create the assembly (dll) either:\n\n* Compile the project “Fastenshtein” in Release config in Visual Studio.\n\nOR\n\n* Download the pre-compiled dll from [nuget](https://www.nuget.org/api/v2/package/Fastenshtein/) unzip the package and use the dll in \\lib\\net452 folder.\n\n4. Create the assembly\n```sql\nCREATE ASSEMBLY FastenshteinAssembly FROM 'C:\\Fastenshtein.dll' WITH PERMISSION_SET = SAFE\n```\n\n5. Then create the function\n```sql\nCREATE FUNCTION [Levenshtein](@value1 [nvarchar](MAX), @value2 [nvarchar](MAX))\nRETURNS [int]\nAS \nEXTERNAL NAME [FastenshteinAssembly].[Fastenshtein.Levenshtein].[Distance]\nGO\n```\n\n6. It is now ready to be used: \n```sql\n-- Usage\nDECLARE @retVal as integer\nselect @retVal = [dbo].[Levenshtein]('Test','test')\nSelect @retVal\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanharltey%2Ffastenshtein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanharltey%2Ffastenshtein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanharltey%2Ffastenshtein/lists"}