FuzzySearch.Net 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FuzzySearch.Net --version 0.3.0                
NuGet\Install-Package FuzzySearch.Net -Version 0.3.0                
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="FuzzySearch.Net" Version="0.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FuzzySearch.Net --version 0.3.0                
#r "nuget: FuzzySearch.Net, 0.3.0"                
#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 FuzzySearch.Net as a Cake Addin
#addin nuget:?package=FuzzySearch.Net&version=0.3.0

// Install FuzzySearch.Net as a Cake Tool
#tool nuget:?package=FuzzySearch.Net&version=0.3.0                

FuzzySearchNet

Build

Fuzzy search strings using levenshtein distance.

This package can be used to search strings for sub sequences with a specified max levenshtein distance. Multiple matches with their indexes and distances will be returned if found.

Inspired by fuzzysearch for python (https://github.com/taleinat/fuzzysearch) and to some extent follows the same conventions.

Installation

Build from source or download NuGet package: https://www.nuget.org/packages/FuzzySearch.Net

Target frameworks .Net 6 and .Net Standard 2.1

Usage

Searching for strings in strings

  // Search with default options, substitutions, insertions, deletions and default maximum distance (3)
  var results = FuzzySearch.Find("sometext", "here is someteext for you");   
  
  // Search with specified maximum distance
  var results = FuzzySearch.Find("sometext", "here is someteext for you", 1);  
    
  // Search using only substitutions and default maximum distance (3)
  var results = FuzzySearch.Find("sometext", "here is someteext for you", SearchOptions.SubstitutionsOnly);  
  
  // Search using with more specific options, for example allowing more substitutions than insertions and deletions
  var results = FuzzySearch.Find(word, text, new FuzzySearchOptions(3, 1, 1));
  
  // Check for any matches using Linq. Using Any or First is more efficient than count since enumeration will stop after first match.
  // This will not necessarily yield the best match though.
  if(FuzzySearch.Find(word, text, 2).Any()) {
    // do stuff
  }
  
    
  // Find returns a list of MatchResults with information about matches
  public class MatchResult
  {
      public int StartIndex { get; set; }
      public int EndIndex { get; set; }
      public int Distance { get; set; }
      public string Match { get; set; } = "";
      public int Deletions { get; set; }
      public int Substitutions { get; set; }
      public int Insertions { get; set; }
  }
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net6.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.1.0 2,113 5/23/2024
1.0.0 133 4/19/2024
0.4.0 459 2/24/2024
0.3.3 4,574 11/11/2023
0.3.2 15,176 8/30/2022
0.3.1 405 8/30/2022
0.3.0 402 8/30/2022
0.2.3 412 8/29/2022
0.2.2 393 8/28/2022

Support for streaming find using IAsyncEnumerable