![]() |
VOOZH | about |
dotnet add package NinjaNye.SearchExtensions.Levenshtein --version 4.0.1
NuGet\Install-Package NinjaNye.SearchExtensions.Levenshtein -Version 4.0.1
<PackageReference Include="NinjaNye.SearchExtensions.Levenshtein" Version="4.0.1" />
<PackageVersion Include="NinjaNye.SearchExtensions.Levenshtein" Version="4.0.1" />Directory.Packages.props
<PackageReference Include="NinjaNye.SearchExtensions.Levenshtein" />Project file
paket add NinjaNye.SearchExtensions.Levenshtein --version 4.0.1
#r "nuget: NinjaNye.SearchExtensions.Levenshtein, 4.0.1"
#:package NinjaNye.SearchExtensions.Levenshtein@4.0.1
#addin nuget:?package=NinjaNye.SearchExtensions.Levenshtein&version=4.0.1Install as a Cake Addin
#tool nuget:?package=NinjaNye.SearchExtensions.Levenshtein&version=4.0.1Install as a Cake Tool
PM> Install-Package NinjaNye.SearchExtensions
Levenshtein search allows you to calculate the Levenshtein distance between a string property and any string value.
Levenshtein search methods are only able to be performed on IEnumerable data, meaning using this on an IQueryable data collections will evaluate the query into memory before the Levenshtein calculation is performed.
The following is a list of current and future methods that are available on IEnumerable data.
CompareTo - calculates the levenshtein distance between the supplied term and a given string property.In order to perform a Levenshtein search you must first use LevenshteinDistanceOf supplying the property you wish to calculate the levenshtein distance from.
The following calculates the levenshtein distance between "test" and the StringOne property of TestModel.
context.TestModels.LevenshteinDistanceOf(x => x.StringOne)
.ComparedTo("test");
The levenshtein distance can also be calculated between two properties on the same model. The following snippet calculates the levenshtein distance between StringOne and StringTwo
context.TestModels.LevenshteinDistanceOf(x => x.StringOne)
.ComparedTo(x => x.StringTwo);
The result of the above is defined as IEnumerable<ILevenshteinDistance<T>>.
In order to return the Levenshtein distance for a particular record, a new interface has been created. This interface allows us to return the result of the comparison as well as the source item itself and is defined as follows:
public interface ILevenshteinDistance<out T>
{
int Distance { get; }
T Item { get; }
}
This interface means that you can begin to filter out results based on the Levenshtein Distance. For example if we wanted to retrieve records where the Levenshtein Distance from "test" is less than 5 we would write the following:
var result = data.LevenshteinDistanceOf(x => x.StringOne)
.ComparedTo("test")
.Where(x => x.Distance < 5)
.Select(x => x.Item);
If you have any new feature requests, questions, or comments, please get in touch, either, via my website, through twitter: @ninjanye or by creating an issue through the projects github page .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp1.0 netcoreapp1.0 was computed. netcoreapp1.1 netcoreapp1.1 was computed. netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.0 netstandard1.0 is compatible. netstandard1.1 netstandard1.1 was computed. netstandard1.2 netstandard1.2 was computed. netstandard1.3 netstandard1.3 was computed. netstandard1.4 netstandard1.4 was computed. netstandard1.5 netstandard1.5 was computed. netstandard1.6 netstandard1.6 was computed. netstandard2.0 netstandard2.0 was computed. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net45 net45 was computed. net451 net451 was computed. net452 net452 was computed. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen30 tizen30 was computed. tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Universal Windows Platform | uap uap was computed. uap10.0 uap10.0 was computed. |
| Windows Phone | wp8 wp8 was computed. wp81 wp81 was computed. wpa81 wpa81 was computed. |
| Windows Store | netcore netcore was computed. netcore45 netcore45 was computed. netcore451 netcore451 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on NinjaNye.SearchExtensions.Levenshtein:
| Package | Downloads |
|---|---|
|
LShared.Frameworks
Package Description |
|
|
RezisFramework
Package Description |
Showing the top 1 popular GitHub repositories that depend on NinjaNye.SearchExtensions.Levenshtein:
| Repository | Stars |
|---|---|
|
DanHarltey/Fastenshtein
The fastest .Net Levenshtein around
|
NinjaNye.SearchExtensions.Levenshtein library.