Percentage Match...

185 views
Skip to first unread message

CDZ

unread,
Jul 28, 2009, 4:06:32 PM7/28/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Is there a similar function to what PHP has with similar_text() in
C#?
(http://us3.php.net/manual/en/function.similar-text.php)

Brandon Betances

unread,
Jul 29, 2009, 2:32:13 AM7/29/09
to DotNetDe...@googlegroups.com
hows this?


hope thats what your looking for.

Cerebrus

unread,
Jul 29, 2009, 10:36:54 AM7/29/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
No, there isn't but there have been extension methods and other
implementations written to determine the level of similarity between
two given strings.

The most common method is using the Levenshtein algorithm : (Also make
sure to check the Soundex algorithm)

http://www.merriampark.com/ldcsharp.htm

Other useful links:

http://www.atalasoft.com/cs/blogs/stevehawley/archive/2009/01/26/string-similarity-and-extension-methods.aspx
http://dotnetperls.com/Content/Levenshtein-Implementation.aspx
http://en.wikipedia.org/wiki/Category:String_similarity_measures
http://en.wikipedia.org/wiki/Soundex

Peter Smith

unread,
Jul 29, 2009, 12:38:18 PM7/29/09
to DotNetDe...@googlegroups.com
Well, oh masterful watcher, PHP has levenshtein() and soundex() as
well. similar_text() Oliver's Decision Graphs, building them using
MMLP...I'll save the list the discussion and all, but the paper is at
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=EBA8E104EF29FB4C88B1D2ED17CB0A3B?doi=10.1.1.52.1476&rep=rep1&type=pdf.

But, I digress. C# implementation of this one? Hrm. My searchFu
escapes me. I'd suggest digging up the php implementation and
converting, if you need the accuracy of this method (and can afford
the O(n*n*n) time complexity).

Course, if I get bored, I might do the same. :)

-- Peter Smith

CDZ

unread,
Jul 29, 2009, 12:43:04 PM7/29/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hmm, that's what I was afriad of, I guess I'll just go with the
Levenshtein algorithm, it's not exactly what I wanted but it'll have
to do.



On Jul 29, 9:36 am, Cerebrus <zorg...@sify.com> wrote:
> No, there isn't but there have been extension methods and other
> implementations written to determine the level of similarity between
> two given strings.
>
> The most common method is using the Levenshtein algorithm : (Also make
> sure to check the Soundex algorithm)
>
> http://www.merriampark.com/ldcsharp.htm
>
> Other useful links:
>
> http://www.atalasoft.com/cs/blogs/stevehawley/archive/2009/01/26/stri...http://dotnetperls.com/Content/Levenshtein-Implementation.aspxhttp://en.wikipedia.org/wiki/Category:String_similarity_measureshttp://en.wikipedia.org/wiki/Soundex

Brandon Betances

unread,
Jul 29, 2009, 3:11:25 PM7/29/09
to DotNetDe...@googlegroups.com
oooooooooooooh you don't just want to compare them, but know how much they are alike. sorry mate.

CDZ

unread,
Jul 30, 2009, 8:49:30 AM7/30/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Yea, almost like a search engine relevancy... mostly to catch things
like John vs Jon, Car vs Cars, they're not 100% equal but close...





On Jul 29, 2:11 pm, Brandon Betances <bbetan...@gmail.com> wrote:
> oooooooooooooh you don't just want to compare them, but know how much they
> are alike. sorry mate.
>
> On Wed, Jul 29, 2009 at 12:43 PM, CDZ <curt.zieg...@gmail.com> wrote:
>
> > Hmm, that's what I was afriad of, I guess I'll just go with the
> > Levenshtein algorithm, it's not exactly what I wanted but it'll have
> > to do.
>
> > On Jul 29, 9:36 am, Cerebrus <zorg...@sify.com> wrote:
> > > No, there isn't but there have been extension methods and other
> > > implementations written to determine the level of similarity between
> > > two given strings.
>
> > > The most common method is using the Levenshtein algorithm : (Also make
> > > sure to check the Soundex algorithm)
>
> > >http://www.merriampark.com/ldcsharp.htm
>
> > > Other useful links:
>
> >http://www.atalasoft.com/cs/blogs/stevehawley/archive/2009/01/26/stri...
>
Reply all
Reply to author
Forward
0 new messages