SunilRai86
SunilRai86

Reputation: 1020

is there any method that will find nearest match

I want to compare two strings, such as:

 str1 = "this is a dynamic data";
 str2 = "this is a <data_1> data";

Is there any method that will find the nearest match? I have used Ternary Search Tree (TST) Dictionary functions. Are there any other ways to do this kind of thing?

Upvotes: 1

Views: 458

Answers (3)

Thomas Jungblut
Thomas Jungblut

Reputation: 20969

What about the Jaccard similarity coefficient? http://en.wikipedia.org/wiki/Jaccard_index

It's easy to implement and gives a good similarity score. You have to tokenize your sentences though ;)

Upvotes: 1

user765671
user765671

Reputation: 154

In am not sure about this thing in C#, but yes that is there in SQL,

select difference('this is a dynamic data','this is a dynamic')

Upvotes: 1

crypted
crypted

Reputation: 10306

There is no such method in BCL that finds nearest match of the string. But you can roll your own. read about "Levenshtein Distance" on the following link

Upvotes: 1

Related Questions