stephengtuggy / SgtFuzzyMatch

A .NET library for fuzzy matching of structured data records

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Cosine Similarity implementation of IStringSimilarityComparer

stephengtuggy opened this issue · comments

Is your feature request related to a problem? Please describe.
This library needs to include as many relevant algorithms as reasonably possible. Cosine Similarity is one.

Describe the solution you'd like
A class should be created, called CosineStringSimilarityComparer, that implements IStringSimilarityComparer by calculating the cosine similarity of two strings, then converting the resulting floating-point number between 0.0 and 1.0 to a Fraction, rounded probably to the nearest 1/100th.

Describe alternatives you've considered
N/A

Additional context
I'm pretty sure that this functionality has already been implemented in C# elsewhere; however, as always, we must be careful to observe licensing restrictions. Whatever code you use or adapt must be LGPL-compatible.