Skip to content

Repository files navigation

Fastenshtein

The fastest .Net Levenshtein around.

I got tired of seeing slow Levenshtein implementations, think of the CPU cycles we could be saving! You owe it to your end user to use this.

Under the MIT license also available as NuGet package.

Find this useful? Let me know to make me happy.

Usage

intlevenshteinDistance=Fastenshtein.Levenshtein.Distance("value1","value2");

Alternative method for comparing one item against many (quicker due to less memory allocation)

Fastenshtein.Levenshteinlev=newFastenshtein.Levenshtein("value1");foreach(variteminnew[]{"value2","value3","value4"}){intlevenshteinDistance=lev.Distance(item);}

SQL Server Hosting (SQLCLR)

If you are crazy enough to want to do this. Place the Fastenshtein.dll on the SQL Servers hard drive and do the following…

CREATE ASSEMBLY Fastenshtein from'C:\Program Files\Microsoft SQL Server\MSSQL11.DEV\MSSQL\Binn\Fastenshtein.dll' WITH PERMISSION_SET = SAFE
CREATE FUNCTION [dbo].[Levenshtein](@s [nvarchar](4000), @t [nvarchar](4000))
RETURNS [int] WITH EXECUTE AS CALLER
AS EXTERNAL NAME [Fastenshtein].[Fastenshtein.Levenshtein].[Distance]
GO
-- Usage
DECLARE @retVal asintegerselect @retVal = [dbo].[Levenshtein]('Test','test')
Select @retVal

About

The fastest .Net Levenshtein around

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages