-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ee57e1
commit cb4aea5
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# LevenshteinSimilarity Class | ||
|
||
**Static class providing extension methods for calculating the Levenshtein similarity between two strings.** | ||
|
||
## Class Members | ||
|
||
```csharp | ||
CalculateLevenshteinSimilarity( | ||
string source, | ||
string target) | ||
``` | ||
|
||
Calculates the Levenshtein similarity between two strings. | ||
|
||
### Parameters | ||
|
||
- `source` (Type: `string`): The source string for comparison. | ||
- `target` (Type: `string`): The target string for comparison. | ||
|
||
### Returns | ||
|
||
- Type: `int` | ||
- Description: An integer representing the Levenshtein similarity between the two strings. | ||
|
||
### Example | ||
|
||
```csharp | ||
using NetPlus.Algorithms.Comparison; | ||
|
||
// Example strings | ||
string source = "Hello World"; | ||
string target = "Hello"; | ||
|
||
// Calculating Levenshtein similarity | ||
int similarity = source.CalculateLevenshteinSimilarity(target); | ||
|
||
// Displaying similarity | ||
Console.WriteLine(similarity); | ||
``` | ||
|
||
### Usage | ||
|
||
To use the `LevenshteinSimilarity` class, simply call the `CalculateLevenshteinSimilarity` method with the appropriate parameters. | ||
|
||
```csharp | ||
// Example usage | ||
int similarity = source.CalculateLevenshteinSimilarity(target); | ||
``` | ||
|
||
### Remarks | ||
|
||
The `LevenshteinSimilarity` class uses the Levenshtein algorithm to calculate the similarity between two strings. It returns an integer value representing the similarity between the two strings. |