Is there an algorithm for generating homophones?
Input "cypress", output = { cipress, cipres, cypres, sipress, sypress }
56 Answers
Soundex is the reverse of this - mapping homophones to the same value. If you indexed every word in a dictionary by its Soundex value, then you could do a lookup to find all homophones of a given word.
I made one. Source code here: https://github.com/evanshort73/homophone
Try it out in your browser at http://evanshort.name/homophone/
Basic idea: Download the CMU Pronouncing Dictionary, and create a file of allowed phoneme substitutions and their costs. Do a depth first search of every possible substitution, backtracking when the partial result is not the beginning of any dictionary word.
You might be better off downloading a list of homophones from a web site somewhere. A quick Google search for "list of homophones" gives a few interesting-looking sites, including http://www.homophone.com.
3Project Gutenberg has the Webster's Unabridged Dictionary available for download. You could use the pronunciations in the dictionary as a key. Just parsing the dictionary would be a project unto itself, though.
There is a (and I quote..) Homophoner (stiffled giggle) here: http://yacomink.com/homophoner/
It seems to be using YUI
2Try It.This Library will generate as you required
npm install homophonizer
ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJoa2prZmh%2FeHvHqKSoqJiku6Z5xp6lnqqRqbyz