954,228 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Phonematic Name Search in C#

I just wrote a phonematic name search in C# using the Levenshtein Distance Algorithm. It is very tricky and was quite hard to figure out. This is the samething google uses, and many major search engines. it matches by rank to the text you type in, even if it is mispelled. I believe in open source, and I wrote this for one of my company projects, and with a little simple modification. You can use it for yourself. If you would like a copy of the source. feel free to contact me. Also, I am an expert in .NET so if you need help. Just ask.

shabosco
Newbie Poster
2 posts since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

It would be nice of you to post something in the code snippets section if it is easy enough to just isolate the relevant code sections. I think many people would be interested in taking a look.


Ed

I just wrote a phonematic name search in C# using the Levenshtein Distance Algorithm. It is very tricky and was quite hard to figure out. This is the samething google uses, and many major search engines. it matches by rank to the text you type in, even if it is mispelled. I believe in open source, and I wrote this for one of my company projects, and with a little simple modification. You can use it for yourself. If you would like a copy of the source. feel free to contact me. Also, I am an expert in .NET so if you need help. Just ask.
cosi
Junior Poster
153 posts since Aug 2004
Reputation Points: 17
Solved Threads: 1
 

[QUOTE=shabosco]I just wrote a phonematic name search in C# using the Levenshtein Distance Algorithm.

Hi Shabosco, this is arif, i need the source for search file, as am struck in one of my project that rquires the file search. It would be of great pleasure if you could post it to my mail id : [email]arif_829@rediffmail.com[/email].
Thanks in advance
Arif

arifmd09
Newbie Poster
1 post since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Hi.

Any idea how do i...

i) arrange/sort people's names displayed in a listbox in alphabetical order AND by their surnames?

ii) search for people by name? (my code now can only search by their ID no.)


Thz a lot!

c#dummie
Light Poster
38 posts since Jul 2005
Reputation Points: 10
Solved Threads: 1
 

Hi there,
I am trying to find person names from text files in DOT NET. Could you help me with some guidelines with your code?
My yahoo id is [EMAIL="sandeepiitm@yahoo.com"]sandeepiitm@yahoo.com[/EMAIL]

sandeepiitm
Newbie Poster
1 post since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

This might be what you're after.... not 100% sure as just passing through the thread.

It's always worth Googling for Java solutions to these problems. This code took 2min to transpose from Java to C#

My apologise if I've misunderstood what people are after.

public static int GetLavenshteinDistance(string s, string t) {
   if (String.IsNullOrEmpty(s) || String.IsNullOrEmpty(t)) throw new ArgumentException("The strings must not be null.");
   /*
    * Ported from a Java algorithm by Chas Emerick
    *  <a href="http://www.merriampark.com/ldjava.htm">http://www.merriampark.com/ldjava.htm</a> 
    * 
    */
   int n = s.Length;
   int m = t.Length;
   if (n == 0) {
    return m;
   } else if (m == 0) {
    return n;
   }
   int[] p = new int[n + 1];
   int[] d = new int[n + 1];
   int[] _d;
   char t_j;
   int cost;
   for (int i = 0; i <= n; i++) {
    p[i] = i;
   }
   for (int j = 1; j <= m; j++) {
    t_j = t[j - 1];
    d[0] = j;
    for (int i = 1; i <= n; i++) {
     cost = (s[i - 1] == t_j) ? 0 : 1;
     d[i] = Math.Min(Math.Min(d[i - 1] + 1, p[i] + 1), p[i - 1] + cost);
    }
    _d = p;
    p = d;
    d = _d;
   }
   return p[n];
  }
Numen
Newbie Poster
4 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You