4 ms·
Show HN: Finding puns computationally
- timvdalen 10y agoVery cool! How did you build this?
- kenrick95 10y agoI found his source code on GitHub. [0] From 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 https://github.com/ssaamm/pun-generator 1: https://github.com/ssaamm/pun-generator/blob/master/src/app.py#L105 https://github.com/ssaamm/pun-generator/blob/master/src/app....
- saamm 10y agoNailed it! 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 http://www.speech.cs.cmu.edu/cgi-bin/cmudict
- bbcbasic 10y agogirls just Java have fun better the Java you know Ha ha! :-)
- ajamesm 10y ago> a man's home is his asshole > don't put all your eggs in one asshole It checks out.
- thasaleni 10y agoto DRINK home the bacon.
- s3arch 10y ago>curl your lisp >program makes perfect >No puns found :(
- JoelSanchez 10y agoI think I've found a bug: sometimes it does not return puns, but the correct idioms instead. For example, "words": 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
- mmierz 10y agoI love this! But if you choose words that commonly appear in idioms, you just get the original idiom back. Example: 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