cataloteca.LevenshteinDistance 1.0.1

Algorithm used to calculate the distance and similarity between two strings.

Install-Package cataloteca.LevenshteinDistance -Version 1.0.1
dotnet add package cataloteca.LevenshteinDistance --version 1.0.1
<PackageReference Include="cataloteca.LevenshteinDistance" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cataloteca.LevenshteinDistance --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Levenshtein Distance

Algorithm used to calculate the distance and similarity between two strings.

How to use Levenshtein Distance Algorithm?

  • Use Leveshtein project
	using cataloteca.algorithms.LevenshteinDistance;
  • Define your reference, ie the string you want to compare with your data.
	string reference = "Example";
  • Define your targets, ie the data you want to compare with the reference.
	List<string> exampleList = new List<string>(new string[] {
        "example 1",
        "example 2",
        "example 3"
    });
  • Use the method to calculate distance and similarity. By default the method returns the distance and similarity values, but you may not return one of the metrics

	// Method that calculates string distance and similarity
    var bothCalc = new LevenshteinInput(reference, exampleList);
    var data = bothCalc.CallLevenstheinCalc(similarity:true, distance:true);

	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Distance: 2,00 | Similarity: 77,78%

	// example 2
	// Distance: 2,00 | Similarity: 77,78%

	// example 3
	// Distance: 2,00 | Similarity: 77,78%
  • Use the method to calculate similarity only

	// Method that calculates similarity only
		var similarityCalc = new LevenshteinInput(reference, exampleList);
		var data = similarityCalc.CallLevenstheinCalc(similarity:true, distance:false);


	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Similarity: 77,78%

	// example 2
	// Similarity: 77,78%

	// example 3
	// Similarity: 77,78%

  • Use the method to calculate distance only
	// Method that calculates only the distance
	var distanceCalc = new LevenshteinInput(reference, exampleList);
	var data = distanceCalc.CallLevenstheinCalc(similarity:false, distance:true);

	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Distance: 2,00

	// example 2
	// Distance: 2,00

	// example 3
	// Distance: 2,00

Levenshtein Distance

Algorithm used to calculate the distance and similarity between two strings.

How to use Levenshtein Distance Algorithm?

  • Use Leveshtein project
	using cataloteca.algorithms.LevenshteinDistance;
  • Define your reference, ie the string you want to compare with your data.
	string reference = "Example";
  • Define your targets, ie the data you want to compare with the reference.
	List<string> exampleList = new List<string>(new string[] {
        "example 1",
        "example 2",
        "example 3"
    });
  • Use the method to calculate distance and similarity. By default the method returns the distance and similarity values, but you may not return one of the metrics

	// Method that calculates string distance and similarity
    var bothCalc = new LevenshteinInput(reference, exampleList);
    var data = bothCalc.CallLevenstheinCalc(similarity:true, distance:true);

	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Distance: 2,00 | Similarity: 77,78%

	// example 2
	// Distance: 2,00 | Similarity: 77,78%

	// example 3
	// Distance: 2,00 | Similarity: 77,78%
  • Use the method to calculate similarity only

	// Method that calculates similarity only
		var similarityCalc = new LevenshteinInput(reference, exampleList);
		var data = similarityCalc.CallLevenstheinCalc(similarity:true, distance:false);


	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Similarity: 77,78%

	// example 2
	// Similarity: 77,78%

	// example 3
	// Similarity: 77,78%

  • Use the method to calculate distance only
	// Method that calculates only the distance
	var distanceCalc = new LevenshteinInput(reference, exampleList);
	var data = distanceCalc.CallLevenstheinCalc(similarity:false, distance:true);

	// Console Response Sample

	// example
	// -------------------
	// example 1
	// Distance: 2,00

	// example 2
	// Distance: 2,00

	// example 3
	// Distance: 2,00

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 292 9/28/2019
1.0.0 148 9/19/2019