I scraped some idioms from the web, and take the 10 with the lowest score relative to the input word.
To score an idiom relative to an input word, I first convert the input word and each word in the idiom to phonemes (using cmudict [0]). I find the minimum Levenshtein distance between the input word's phonemes and the phonemes of a word in the idiom. The score for the idiom is that minimum distance divided by the number of phonemes in the word that had the minimum score.
The idea with dividing it is to give longer words a bit of a boost (though admittedly I didn't test that rigorously).
9 comments
[ 3.2 ms ] story [ 18.9 ms ] threadFrom this[1], seems like he's taking the top-10 closest (in terms of Lehvenstein distance) phoneme of input and idioms of English language.
0: https://github.com/ssaamm/pun-generator
1: https://github.com/ssaamm/pun-generator/blob/master/src/app....
I scraped some idioms from the web, and take the 10 with the lowest score relative to the input word.
To score an idiom relative to an input word, I first convert the input word and each word in the idiom to phonemes (using cmudict [0]). I find the minimum Levenshtein distance between the input word's phonemes and the phonemes of a word in the idiom. The score for the idiom is that minimum distance divided by the number of phonemes in the word that had the minimum score.
The idea with dividing it is to give longer words a bit of a boost (though admittedly I didn't test that rigorously).
0: http://www.speech.cs.cmu.edu/cgi-bin/cmudict
better the Java you know
Ha ha! :-)
> don't put all your eggs in one asshole
It checks out.
>program makes perfect
>No puns found :(
a man of few words
a picture paints a thousand words
a woman of few words
actions speak louder than words
mark my words
picture paints a thousand words
put words in somebody’s mouth
Actions speak louder than words
cat
>cat got your tongue
>cat nap
>curiosity killed the cat
>fight like cat and dog
>grin like a cheshire cat
>let the cat out of the bag
>no room to swing a cat
>not enough room to swing a cat
>not have a cat in hell’s chance
>play cat and mouse