Skip to content

Commit

Permalink
Create ngramsimilarity.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gsilvamartin authored Feb 24, 2024
1 parent cb4aea5 commit 6e23a5f
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions docs/docs/algorithms/comparison/ngramsimilarity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# NgramSimilarity Class

**Static class providing extension methods for calculating the N-gram similarity between two strings.**

## Class Members

```csharp
CalculateNgramSimilarity(
string text1,
string text2,
int n = 2)
```

Calculates the N-gram similarity between two strings.

### Parameters

- `text1` (Type: `string`): The first string for comparison.
- `text2` (Type: `string`): The second string for comparison.
- `n` (Type: `int`): The size of N-grams to be used (default is 2).

### Returns

- Type: `double`
- Description: A double value representing the N-gram similarity between the two strings, ranging from 0.0 to 1.0.

### Example

```csharp
using NetPlus.Algorithms.Comparison;

// Example strings
string text1 = "Hello World";
string text2 = "Hello";

// Calculating N-gram similarity
double similarity = text1.CalculateNgramSimilarity(text2);

// Displaying similarity
Console.WriteLine(similarity);
```

### Usage

To use the `NgramSimilarity` class, simply call the `CalculateNgramSimilarity` method with the appropriate parameters.

```csharp
// Example usage
double similarity = text1.CalculateNgramSimilarity(text2);
```

### Remarks

The `NgramSimilarity` class uses the N-gram similarity algorithm to calculate the similarity between two strings. It returns a double value representing the similarity between the two strings, ranging from 0.0 to 1.0.

0 comments on commit 6e23a5f

Please sign in to comment.