Question: I am trying to code in PHP for homophones: The section of the assignment I am working on has instructions below: For this task we
I am trying to code in PHP for homophones: The section of the assignment I am working on has instructions below:
For this task we will compare the output of two functions: soundex() and metaphone(). You will need again your list of misspelled words. You will then do 2 comparisons as described below. (use soundex() and metaphone()). Your output file (homophones.txt) should contain two records for each word. The first field is the word itself. The second field is the number of other words that this record is similar to. (The first record is the information for soundex(), while the second record is the information for metaphone()). Finally, each record will have a variable number of additional fields listing the words that sound similar to the word for this particular record. Here is a sample output file for the records for word1.
word1:4:word2:word3:word4:word5
You will need to first calculate the soundex() and metaphone() string for each word in your dictionary, and each word in your misspelled word list. Then take each misspelled word, and compare its soundex() and metaphone() values with the values in the dictionary. Keep records of the words that match and this is the data that will be output to your file.
A simple set of misspelled words would work for the sake of working code so that the whole file doesnt have to be uploaded here.
misspelling examples :
kat: cat
krack: crack
zylophone:xylphone
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
