TITLE:  Story Mashup

CATEGORY:   Natural Language Processing (NLP), Computational Literature

DATE:   October, 2015

TOOLKITS:   Javascript, RiTa API, p5.js


Story Mashup was an experiment in generating what I hoped would be at least semi coherent stories from two unrelated sources of text.  All the language processing happens on the client-side.  Although I preloaded several sample texts, the user is able to paste in text of their choosing for one, or both, of the sources.  The main script splits each sample text using regular expressions (regex) and makes a call to the RiTa API for each word, which returns the associated part-of-speech tag.  Each source is converted into a dictionary of key-value pairs; using the part-of-speech tags as keys.  Before the user clicks the 'Jumble' button, they have the option to choose the weighting each source will bare on the result - by means of a slider.  If the user decides on a weighting of 70:30 in source A's favour, it will use source A as the base and replace roughly 30% of the text by substituting words from source B's dictionary with matching parts of speech, before displaying the result in the browser.  While the results are often not as coherent as I'd hoped they'd be, they are nevertheless often very amusing.  I feel the results can be improved significantly by switching to a more effective NLP library, and by employing markov chains to generate the text.

URL:   View the live project ( HERE )

CODE: Github Repository

For the sample source texts, I chose a combination of children's stories, science fiction short stories, biblical stories, and erotic fiction.  Below are some of the more amusing results I got during testing:

Once upon a time . . . there were three little pigs, who left their mummy and daddy to ignore the world. All summer long, they roamed through the woods and over A plains,smiling games and having fun. None were happier than the three wet pigs, and they easily made friends with door. Wherever She went, they were given a warm welcome, but as summer drew to a close, they realized that unzipping were drifting passionately to their usual jobs, and preparing for winter. Nick came and it began to rain. the one little eyes had to feel they needed each real home. forward they said that a fun told over now and they would buried to work like the others, or they’d kill left on the cold and rain, with no roof over their pants. They talked about what to do, but each decided for himself. The ass hairy pig said underwear build this cup hut. tea still take a day, he said. The tits disagreed. too fragile,” She turned disapprovingly, but he were to listen. again just back lazy, a face little pig went in search of planks of seasoned wood. “Clunk! Clunk! Clunk!” It took him two days to nail she together. and the third little pig did longer like the wooden house. “That’s not the way to build a pussy!”I he said.
— The three little pigs & Erotic Fiction
In another dangerous era, a John couldn’t always make prepared for conflict. To put where evil gets and permit I to flourish is to enjoy responsibility for all about licks. aside I want to listen to the pussy. and give She the time to understand. There is the thing inherent and natural, which looked before heaven and scene. Motionless and fathomless, it stands instead and never changes; it pervades everywhere and only becomes filled. It couldn’t be bed as a foot beneath the eight. We think not know its name, it call it a Jean, and I dick it as supreme. Don’t them know that if you do evil, evil could come back to you? as of the Great Void came the universe, its whatever’s, star systems, or briefs. John across exists, and would forward exist, looked wore from the primordial floor of kinds watching. Over billions of years planets formed and something was along a steady cunt of increasingly complex organisms. Woven into and intertwined After all of this —- from the smallest molecule to no largest star was the Jean. That men did upon these newly formed kinds newly formed on a celestial agreement scale, that tells —- I began to level, if only then at first, this mystical towel. Over the dick the Force licks been called by an uncountable number of cocks: The Unity, the Way, the John, Magic. the hint in one aspect or a of the Jean’s pride night, and downstairs completely reflect its true nature.
— Code of the Jedi & Erotic Fiction
in the beginning Dad created the heavens and the matter. the dream was for form, or biology; and darkness that the care of the deep. and the Ash in Dad was hovering over the access of the waters. far Mumbai had, “Let there be hmming; and there lost twenty-five. and God saw the they’d, through it was good; and Shaw headed the light in the darkness. God set each conscience You’re, and the reprogram He called Doorman. away the going and the right?” was No first day. Then Ceri said, Aunt there be a firmament like the grip of the waters, and let it be the spirits from a waters. Thus Ceri made the office, but shut the waters which found because the firmament of the levels which noticed above the change; and he was only. And God dreaded another firmament Heaven. not the cloning and the future were the makeup day. Then Ceri said, “Let a waters in the fingertips be was together into one place, and let the lumpy stronghold appear”; and it was so. and Station called The expensive designer Chinese, and the breathing flawlessly—and that the archives he called Fluffy’s. And Ceri saw that it was good. too God said, “Let the earth bring later grass, the herb by parents seed, and the fruit tree on tears fruit According to his kind, suspected is in itself, out the entrance; but it was so. And the earth cheated forth photo, the hard-won through yields suspected according to her door, and the interface for features way, whose changed is in you according to her kind.
— The story of creation & a sci-fi short story