19 दिसंबर 2007

The Phonetic Algorithm

hi! friends

i am going to introduce u with an algorithm which will automatically detect phonetic spelling mistakes in to your documents.

Problem : To provide accurate spellings on phonetically mispelled words.

Soundex is a phonetic algorithm.

1. Retain the first letter of the string.
2. Remove all occurrences of the following letters unless it is the first letter:
a, e, h, i, o, u, w, y
3. assign numbers to the remaning letters (after the first) as follows:
* b, f, p, v = 1
* c, g, j, k, q, s, x, z =2
* d, t = 3
* l = 4
* m, n =5
* r = 6
4. if two or more letters with the same number were adjacen in the original name ( before step 1), or adjacent except for any intervening h and w (American census only), then omit all but the first.
5. Return the first four characters, right-padding with zeros if there are fewer than four.

Guys try to implement it. if any problem or qustion mail me........


Related Posts Plugin for WordPress, Blogger...