Google Ngram Mad Libs

Once upon a time there was a little girl who was not a member of the family. She was a very good friend of mine. When she was a child and I was a little girl in a white dress and a white apron and a pair of shoes, we had to do something. So we have to get out of the way of the world.  I thought I was going to be a long night of darkness and silence. Instead it was a matter of life and death of the son of the late King of Prussia. This seemed to be the only one who could have been a lot of talk. Despite this we have to be careful not to let the sun go down on our knees. Incredibly, it was not until the early 1980s that the government was forced to take a job in the city. That meant that the first two of these were in fact the same as the one in the middle. Neither of us had ever seen a man who was a stranger. Of course she did not know what to say to him. After a while I got up and went to the door of the house and the garden. Finally I said to him that he was not a man.

Do you remember that great party game Mad Libs, where you have a template of a story with blanks in strategic places and the host calls out parts of speech? The audience calls back with suggested fillers, usually wacky, suggestive, or ribald, which the host uses to complete story, and which is then read back to great hilarity. I have taken this further. The above story was written by Google. Yes, Google Ngram Viewer now has a feature where it will return to you the 10 most frequent words fitting in a phrase where you have placed a wildcard symbol (an asterisk), as determined by the millions of books and periodicals it has scanned. It can only go up to 5-grams, which means you can feed it the first four words and it will provide you the most frequent fifth word.

So I fed it the underlined phrase “Once upon a time” and here’s what I got. With each new word filled in I used the preceding four words to provide the next. In most cases I used the most frequent word that Google provided but I had to make a few exceptions. If the word had gender, and both genders were represented as top frequent words, I took the one that made the most sense. I also picked the correct tense once or twice to make the sentence grammatical, but I did not allow logic, plot, or style drive any exceptions I made. I had to choose the second or third choice a few times to avoid getting into a repeating loop (e.g. “a white dress and a white apron and a white dress and …”). Since the Ngram viewer no longer includes Ngrams that go across sentence endings, I had to choose a stopping point myself, sometimes choosing the third or fourth returned word in place of “and” to avoid one long run-on sentence. Then I had to provide a new seed phrase consistent with what came just before. I tried not to guide the story with these. I have underlined all the seed phrases. At times Google’s page could not find a fifth word to complete a phrase, even though it had found the preceding phrase frequent, so in those cases I would reduce the feed to the last two or three words instead of four.

You can play this game too. To get a bit more life in the story you can try some crazier seed phrases or just choose responses further down the list than I did.