What is u/PORTMANTEAU-BOT?
It's a Reddit bot which automatically generates portmanteaux of 2-word Reddit comments and posts them as replies.
From Wikipedia:
A portmanteau (/pɔːrtˈmæntoʊ/, /ˌpɔːrtmænˈtoʊ/; plural portmanteaus or portmanteaux /-ˈtoʊz/) or portmanteau word is a linguistic blend of words, in which parts of multiple words or their phones (sounds) are combined into a new word, as in smog, coined by blending smoke and fog, or motel, from motor and hotel. In linguistics, a portmanteau is defined as a single morph that represents two or more morphemes.
The only thing included here is the core function to generate portmanteaux - the quality control functions (and the dictionaries they use) are kept private to protect the bot from having unsavoury words put in its mouth.
If it was a 2-word comment with no weird punctuation, it must have failed a quality check. Perhaps one of the words in your comment was less than 5 characters. Perhaps your comment had a mundane word in it like "thanks", "please", or it was someone's name. Perhaps it contained bad language or produced a portmanteau that did. The bot constantly has hundreds of comments to choose from and so vetoes the vast majority of them (see the list of quality controls below).
The bot streams all comments from across Reddit and looks for 2-word comments. It does some quality control (see below) which vetoes most of those comments as bad portmanteau fodder. If it finds a good comment, it constructs a portmanteau and applies some more quality control checks, abandoning any bad results. Finally, it posts the portmanteaux that make it through. It also checks its post history, deleting its downvoted comments and defending its honour from unfair human harassment.
There are two sets of filters: one on the comments read from Reddit as inputs, and one on the output portmanteaux that are considered for posting:
Controls on input
-
Require each of the 2 words to be at least 5 letters long
-
Veto comments that are just people's names, using a list of common first names.
-
Veto comments that contain "bad" words or fragments of words, using a list of commmon chatter such as "thank", "hahaha", "where", etc, as well as curses and slurs.
-
Veto comments where 1 of the words has a "bad" ending such as "-ing", as these tend to make meaningless portmanteaux.
Controls on output
-
Veto portmanteaux which are shorter than the shortest input word.
-
Veto portmanteaux which contain slurs.
Here's a brief summary of the procedure, for which you can read the source code in the function makepm():
-
Look for 3-letter strings in common - if found, stitch the words together over those. Otherwise, continue.
-
Find & record the positions of all vowels in string A and string B.
-
Look for common vowels between the two strings (excluding any matches that fall in the first 2 letters of string A or the last 2 letters of string B, in order to preserve as much of the original strings as possible).
-
If common vowels pass these tests, their positions are used to split the original strings, which are then concatenated about the shared vowel.
-
If no common vowels are found to pass these tests, any vowel pair is considered.
-
Preference is given to late vowels in string A and early vowels in string B, in order to preserve as much of the original strings as possible.
-
Once vowels are selected, their positions are used to split the original strings, which are then concatenated about the vowel from string B.
-
Priority is given to the vowel from string B and it replaces the vowel from string A, as this helps the portmanteau rhyme better with the original phrase.
Sure - you can read it or try it out yourself by cloning this repo and using the script demoPM.py, for example:
$> ./demoPM.py labrador poodle
Output portmanteau is 'labradoodle'
$> ./demoPM.py mock documentary
Output portmanteau is 'mocumentary'
$> ./demoPM.py television evangelist
Output portmanteau is 'televangelist'
It used to be confined to an old Ubuntu laptop under my bed, but thanks to the GitHub student developer pack and AWS educate, it has ascended (for free!) to the divine halls of Amazon Web Services where it shall live forever more... or at least until the next time AWS breaks.
You tell me - the bot's best efforts are viewable here.
Use the bot's post history (with associated upvotes) to train a neural network as a binary classifer to separate good and bad portmanteaux. Then, slot this in right before posting as a final quality check, hopefully improving the quality of future output.