Fifty Shades Of Grey
A "Fifty Shades of Grey" text generator randomly recreates passages similar to those from the erotic novels. Reuters

You may have heard of this movie called "Fifty Shades of Grey" coming out in theaters on Friday and perfect (so they say) for Valentine's Day. The movie, starring Dakota Johnson and Jamie Dornan, is an adaptation of E.L. James' erotic novel of the same name, which has sold more than 50 million copies worldwide. If you looked at people reading the book on the train and scoffed at the idea of anyone taking it seriously, Thursday may bring some validation. Lisa Wray had some fun and created a "50 Shades of Grey" text generator that creates steamy, grammatically correct "mommy porn" with a simple click of a button.

Wray's friend shared her story on Reddit. A developer advocate at Google, she was challenged to create text similar to "50 Shades of Grey" using a computer and developed a random text generator using the Dada Engine. "The engine parses a 'grammar' file and turns it into a list of vocabulary and rules, then recursively evaluates the input, choosing randomly among options at each juncture," Wray explains. The Dada Engine provided a good platform to start the project, but she still had to add more than 1,000 lines of code to make the story flow and not sound like something Yoda would say in "Star Wars."

Wray's efforts produce text that's equal parts "50 Shades of Grey" and comedy. "The sensual strains of Miley Cyrus drift through the headphones he put on me. I love his choice," reads one randomly generated line of text. "My subconscious has stopped dancing and is staring too, mouth open and drooling slightly," reads another. "My inner goddess is doing the merengue with salsa moves," was perhaps my favorite line of random text.

For a quick project, the "Fifty Shades" text generator was a success, although the options can be limited and some of the phrases get repeated. Wray said she may work up a more sophisticated version in the future.

Random text generators are not new, but they are a fun tool for programmers. Some random text generators have been used to create research papers, which have been accepted to journals, while other generators have been used to create realistic chat bots. You can "talk" to Mitsuku much as you would to a person, for example. In 2014 a computer program passed the Turing Test.

In 1950, Alan Turing wondered if machines could be made to think and devised a test to determine if a human could tell if he was talking to a machine. If a program could fool a human more than 30 percent of the time over several five-minute keyboard conversations, it would pass the Turing Test. "Eugene Goostman" is a simulation of a 13-year-old boy and was the first program to pass the test, fooling judges 33 percent of the time.