Copy Paste Replace

Design and Development

Create Your Own Story With The Power of NLP.

A word replacement game that utilizes the Google Natural Language API and Princeton’s Wordnet database to analyze user-submitted base stories for certain keywords (e.g. adjectives, verbs, and specific types of nouns) and then allows users to replace each keyword to create funny original stories. Users can then personalize each story with a title and a matching animated gif.

Slider

How it works

Here’s a quick breakdown of how the game works:

  1. User copy and pastes in a story as a text snippet or uses the built-in search box to search Wikipedia to use as a source story.
  2. After input is analyzed, user sees a series of word prompts (i.e. adjective, living thing, or location) and enters a corresponding word to fit that criteria.
  3. User views the final output which utilizes the user’s responses to the aforementioned word prompts to generate a new story

Initial Flow

NLP Algorithm Ideation

In order to identify which words of a given text input we needed to replace, we first needed to understand the word’s role and importance in the sentence. Thus I needed to devise an algorithm that would identify not just a word’s part of speech i.e. noun, verb, adverb, direct object, etc., and salience (i.e. the word entity’s significance to the entire text snippet) using Google’s NLP APIs and also its top-level category (aka synset family) using a JSON file generated from a database compiled by wordnet to generate the replacement prompts.

Slider

Combining these two systems allowed us to identify optimal words to replace in order to preserve some semblance of meaning and create more accurate word prompts (i.e. instead of noun, the prompt could be living_thing). This was a decision derived from the hypothesis that generated stories, while mostly nonsensical due to random replacement, are a lot more amusing and enjoyable when they make a little bit of grammatical and logical sense.

Slider
Final algorithm for grabbing word categories from wordnet JSON

Most stories still have a few sentences that don’t quite make sense, but the algorithm tweaks in general gave the user more agency to make relevant word choices which resulted in improved storytelling while maintaining the delight of surprising turns of phrase and irreverent bits of random humor. Try it yourself at copypastereplace.com!

Example Story

Alice, an unpretentious and individual 19-year-old, is betrothed to a dunce of an English nobleman. At her engagement party, she escapes the crowd to consider whether to go through with the marriage and falls down a hole in the garden after spotting an unusual rabbit. Arriving in a strange and surreal place called “Underland,” she finds herself in a world that resembles the nightmares she had as a child, filled with talking animals, villainous queens and knights, and frumious bandersnatches. Alice realizes that she is there for a reason–to conquer the horrific Jabberwocky and restore the rightful queen to her throne.Alice in Wonderland (2010 Film)
Slider

Final Story

Source

Alice, a dying and individual 19-year-old, is betrothed to a frat guy of a badass investment banker. At her engagement baptism, she escapes the crowd to consider whether to go through with the stabbing and falls down a hole in the YMCA after spotting an immortal rabbit. Arriving in a dangerous and surreal Burger King called “Underland, ” she finds herself in a bouncy castle that resembles the nightmares she had as a corpse, filled with talking garden gnomes, manipulative queens and knights, and cheap bandersnatches. Alice realizes that she is there for a reason–to conquer the foaming Jabberwocky and restore the flakey queen to her pile of garbage.Alice in Wonderland (After Replacement)
Skills: Mongoose, Express, React, Node.js
Github: github.com/infernoarchon/copypastereplace
Live Site: copypastereplace.com
Frontend: Alan Chen
Backend: Alan Chen
Timeframe: Winter 2019