home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / programm / 2097 < prev    next >
Encoding:
Internet Message Format  |  1992-07-24  |  2.1 KB

  1. Path: sparky!uunet!mcsun!sun4nl!and!jos
  2. From: jos@and.nl (Jos Horsmeier)
  3. Newsgroups: comp.programming
  4. Subject: Re: Soundex algorithms, database indexing
  5. Keywords: soundex, databases, indexing
  6. Message-ID: <3166@dozo.and.nl>
  7. Date: 24 Jul 92 12:20:17 GMT
  8. References: <1992Jul22.122831.27758@cbnews.cb.att.com>
  9. Organization: AND Software BV Rotterdam
  10. Lines: 55
  11.  
  12. [ I've tried to mail you, but it bounced, so I post it here ... ]
  13.  
  14. In article <1992Jul22.122831.27758@cbnews.cb.att.com> Marc@cbnews.cb.att.com writes:
  15. |Hello programmers/researchers,
  16.  
  17.     [ names stored in a database ... ]
  18.  
  19. |    For the latter one I want to set up a soundex key as well.  I have heard    of the soundex algorithm but never seen any pratical applications.
  20.  
  21. |    I would like to get info/ a 'C' program (function) that makes use of
  22. |    the Soundex algorithm.
  23.  
  24. |    Also any information on using index files (for fast searching) or
  25. |    'C' code would be greatly appreciated.
  26.  
  27. Basically, the Soundex algorithm goes like this:
  28.  
  29. - Chop the first character from the name
  30.  
  31. - Map all the letters according to the following table:
  32.  
  33.     - b, f, p, v             ---> 1
  34.     - c, g, j, k, q, s, x, z ---> 2
  35.     - d, t                   ---> 3
  36.     - l                      ---> 4
  37.     - m,n                    ---> 5
  38.     - r                      ---> 6
  39.     - a, e, h, i, o, u, w, y ---> 7
  40.  
  41. - Where ever a sequence of the equal digits occur, remove them all but
  42.   the first of the sequence
  43.  
  44. - Optionally, chop the first digit from the number
  45.  
  46. - Optionally, remove all sevens (all vowels)
  47.  
  48. - Add some 0's at the end (dependent on the number `n' in the next step)
  49.  
  50. - Take the first n digits and prepend the letter from the first step.
  51.  
  52. The table, given in step 2 is highly language dependent of course,
  53. e.g. in Dutch a dental `t' might be pronounced as a dental `s' and
  54. certain combinations of vowels result in different diphtongues.
  55.  
  56. So, transform all names into their Soundex form and compare the
  57. two results for equality. That's all there is to it ...
  58.  
  59. About your question on indexes: I'd suggest a hashing scheme if it's
  60. unlikely that records will be removed from the database frequently.
  61. On the other hand, a B-tree will do fine too here.
  62.  
  63. kind regards,
  64.  
  65. Jos aka jos@and.nl
  66.  
  67.