Question
Soundex System Soundex is a system that encodes a word into a letter followed by three digits that roughly describe how the word sounds. That
Soundex System Soundex is a system that encodes a word into a letter followed by three digits that roughly describe how the word sounds. That is, similar sounding word have similar four-character codes. For instance, the words carrot and caret are both coded as C630 A slight variation of the Soundex 'coding algorithm is as follows:
1. Retain the first letter.
2. For the remaining letters, delete all occurrences of a, e, i, o, u, h, y, and w.
3. Replace the letters that remain with numbers so that
(a) b, f, p, and v become 1
(b) c, g, j, k, q, s, x, and z become 2
(c) d and t both become 3
(d) l (that is, el) becomes 4
(e) m and n become 5
(f) r becomes 6
4. If the result contains two adjacent identical digits, eliminate the second of them.
5. Keep only the first four characters of what you have left. If you have fewer than four, then add zeros on the end to make the string have length four.
Write a program that carries out the algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started