Question
Write a structured (procedural) Python program that solves the following spec: Soundex System Coding: Soundex is a system that encodes a word into a letter
Write a structured (procedural) Python program that solves the following spec: Soundex System Coding: Soundex is a system that encodes a word into a letter followed by three numbers that roughly describe how the word sounds. Therefore, similar sounding words have the same four-character code. Use the following set of (slightly modified #4) rules to create a translator from English words to Soundex Code: 1. Retain the first letter of the word.
2. For letters 2 ...n, delete any/all occurrences of the vowels (a,e,I,o,u), h, w, y.
3. Assign the following numbers to any remaining letters in the word a. 1 for occurrences of B, F, P, V. b. 2 for occurrences of C, G, J, K, Q, S, X, Z C. 3 for occurrences of D, T d. 4 for L e. 5 for M, N f. 6 for R
4. For repeated numbers, remove the repeats (PROGRAMMING --> P6265552 --> P62652)
5. Keep only the first four characters of what you have left (P62652 --> P626) However, if you have less than 4 characters, 0 fill the empty spots so that ALL words have 4-character soundex codes. (e.g. Anita --> A53 --> A530)
Python program Requirements: Your program is expected to... 1. Well-documented (name, date, description at the top; good naming conventions) 2. provide a description and instructions for the user. 3. ask for the players name and encode it for them, then use their Soundex code name to refer to them. 4. Ask them to encode as many names/words as they would like until they enter 0 to quit. 5. have a minimum of 4 subprograms (including a main()).
store the entered names/words with their codes into a dictionary (name/word as key). When they are finished, write the words with their soundex codes one per line to a text file
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