Code Monkey home page Code Monkey logo

fiftyshades's Introduction

Fifty Shades Text Generator

Computer generated erotica in the style of Fifty Shades of Gray, for the discerning technophile.

This is the code backing my website, xwray.com/fiftyshades. It's generated from a lovingly crafted hand written grammar.

This is a Markov chain text generator, right?

This is the number one question I get, and NO, that would have been easier (but not as cool)! Markov chain generators produce text that "sounds" right but is meaningless and often not grammatically sound (although sometimes the juxtapositions can seem poetic or profound). Most text generators on the web are Markov generators. That's probably because natural language processing is complex and writing a hand-tuned grammar is difficult and time-taking. But considering the gravity of my source material, nothing less would do.

So how does this work?

It's a set of vocabulary and assembly rules (a "grammar"), fed through an "engine" that recursively evaluates them.

A grammar is a series of super-detailed instructions to tell the computer how to write: first starting with various patterns of paragraphs, then constructing each paragraph from a series of possible combinations of sentences, then each sentence from phrases, then each phrase from combinations of specific words.

Provided you have written your rules correctly, this method produces grammatically correct language (such as "Colorless green ideas sleep furiously"). However, you do not have to make semantically meaningful text this way. In fact, most examples of the genre don't. (See the fabulous Postmodernism Generator—where the joke is that it's almost too obscure to tell that it doesn't make sense!). But my personal interest—and the source of humor of this particular project—is in generating text that is indistinguishable from the original material. It is still debatable whether the original is meaningful.

How to run the code

This code is written in pb format and designed for use with the Dada Engine. Once you've downloaded the project, you run it on the command line with your script as an argument:

% ./dada 50shades.pb

I encourage you to read the Dada Engine's manual, especially the section explaining the pb language. As you can see, the tool itself is pretty simple, but you can achieve uncanny results by carefully hand-tuning your grammar.

You can find other examples of pb files by downloading the Dada Engine from the website above. There's also a mirror of the Dada Engine on Github here.

What about the website?

The website randomly shows 1 of 500 pre-generated texts produced by the Dada Engine. It's possible to produce lots more, but this way people can try a number of different texts without repeating and still be able to perma-link any favorites.

Known issues:

The documentation for the Dada Engine explicitly states "If a rule has several options, the same option will never be chosen twice in immediate succession." As far as I can tell, this isn't true—sometimes repeated phrases are generated.

Questions, comments, and feedback welcomed at [email protected].

fiftyshades's People

Contributors

lisawray avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.