Dandraka.FuzzySubstringSearch 1.0.6

dotnet add package Dandraka.FuzzySubstringSearch --version 1.0.6                
NuGet\Install-Package Dandraka.FuzzySubstringSearch -Version 1.0.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dandraka.FuzzySubstringSearch" Version="1.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dandraka.FuzzySubstringSearch --version 1.0.6                
#r "nuget: Dandraka.FuzzySubstringSearch, 1.0.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dandraka.FuzzySubstringSearch as a Cake Addin
#addin nuget:?package=Dandraka.FuzzySubstringSearch&version=1.0.6

// Install Dandraka.FuzzySubstringSearch as a Cake Tool
#tool nuget:?package=Dandraka.FuzzySubstringSearch&version=1.0.6                

FuzzySubstringSearch

Implements n-gram matching in a string, returning a match percentage in the range of 0-100. Search is always case-insensitive.

Example:

using Dandraka.FuzzySubstringSearch;

public void FuzzySubstringSearchExample
{
	var g = new LookingGlass(true); // true = sequential mode on

	int m1 = g.NGram("I'm wearing hedphones now", "headphones", 2);
	Console.WriteLine(m1.ToString()); // 78

	int m2 = g.NGram(@"C:\Users\myuser\OneDrive\LookingGlass Project Team", "MYUSER");
	Console.WriteLine(m2.ToString()); // 100
}

What does 'Sequential Mode' mean?

Sequential mode, in this context, means that as soon as a part of search string is found, subsequect searches look only for the rest of the search string.

For example, when sequential is true, this is what happens when searching for 'cell' in target 'ball center' with 2-grams:

The word 'cell' has 3 x 2-grams: ce, el, ll.

Target 2-gram Is match
ba No
al No
ll Yes: matches ll, the 3rd 2-gram.
l[space] No
[space]c No
ce No: it could match ce but this is the 1st 2-gram, we've already found the 3rd and sequential is on.
en No
nt No
te No
er No

So the result is 1 match / 3 total = 33%.

When sequential is false this restriction does not apply:

Target 2-gram Is match
ba No
al No
ll Yes: matches ll, the 3rd 2-gram.
l[space] No
[space]c No
ce Yes: matches ce, the 1st 2-gram.
en No
nt No
te No
er No

So the result is 2 matches / 3 total = 67%.

Downloading

Please download the Nuget package here.

Development documentation

Please refer to the generated docs here.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 134 4/17/2024
1.0.5 107 4/17/2024
1.0.4 119 4/17/2024
1.0.3 131 4/17/2024
1.0.0 113 4/16/2024

Added tests, dev docs and README with examples.