Machine Learning Assignment 7

Concept

I tried to use Tracery to build a grammar to imitate Chuck Palahniuk’s style.

Quick introduction of Chuck Palahniuk: he’s famous for Fight Club and Haunted. And he’s also happened to be my favorite author. Chuck Palahniuk has a very distinctive writing style. One of the techniques he uses stands out. It’s hard to give it a name, but he likes to suddenly insert a few fragments in his novels that teach the reader how to do certain things. And these paragraphs are usually overlaid with a lot of chemical terms. These clips can give the impression that it is not meant to be read, but to emphasize the identity of the protagonist. For example, the main character of Fight Club makes bombs, so he has sentences that teach the reader how to make bombs.

โ€œYou take a 98percent concentration of fuming nitric acid and add the acid to three times that amount of sulfuric acid. Do this in an ice bath. Then add glycerin drop-by-drop with an eye dropper. You have nitroglycerin.โ€

โ€œMix the nitro with sawdust, and you have a nice plastic explosive. A lot of folks mix their nitro with cotton and add Epsom salts as a sulfate. This works too. Some folks, they use paraffin mixed with nitro. Paraffin has never, ever worked for me.โ€

I chose to mimic the book Survivor because this technique is used more often and is more typical in this book. The main character in this book is a cleaner, so there are plenty of sentences in it to teach you how to clean things up.

He is also fond of using simple elements, which appear repeatedly in the passage, to emphasize certain feelings. “I’m XXX’s XXX” is a famous use of this technique in Fight Club, and I added it to make more fun.

Process

There’s not much to tell, I started with the “I’m XXX’s XXX”sentence:

"GoBack":["I'm #Person#'s #mood# #body#.","I'm #Person#'s #symptom# #body#.","I'm #Person#'s #mood#, #symptom# #body#."],

And to make sure the person’s name is consistent, I put it in the origin:

"origin":["[Person:#name#]#story#"],

Then, I started building the “tutorial” section. To make the sentences richer, the tutorial was divided into “course”, which was the part that says what needs to be done, and “answer”, which was the part that says how to do it:

"course":["#courseEnd# #answerWithEnd##answerAfter#","#courseNotEnd# #answerWithoutEnd##answerAfter#"],

In โ€œcourseโ€, the parts that could be selected were “what kind of stain” and “where the stain is”. Of course, the syntax of “course” was also changeable:

"courseEnd":["The secret to #job# is simple.", "Just ask me how to #job#.<br>No, really, go ahead.<br>Ask me.<br>","There's a way to #job#.","Ask me what's the fastest way to #job#."],

"courseNotEnd":["This isn't the most marketable job skill, but to #job#, ","The secret to #job# is to","You won't learn this in any charm school, but to #job#, "],

"job":["get #jobNoun.s# out of #Object.a#","get #jobNoun# off of #Object.s#","hide #jobNoun.s# on #Object#","remove #jobNoun.s#", "bleach away #jobNoun# from #Object.s#"],

In “answer”, I made it possible to change the syntax and the substances used for cleaning. To make it more flexible, I added the “answerAfter” part:

"answerWithoutEnd":["sink #Object# into #answerLiquidObject# and wiggle them around","sprinkle #Object# with #answerLiquidObject#", "rub #Object# with #answerSolidObject#","dampen #Object# with #answerLiquidObject#","add #answerSolidObject#","turn #Object# inside out and rub #answerSolidObject# on the inside of the crease","rub in #answerLiquidObject#","dissolve five aspirin in water and daub the stain until it's gone", "put on #answerLiquidObject#","polish them with #answerLiquidObject#"],

"answerAfter":[" and wash as usual.",". Rinse them under #answerLiquidObject#.",". <br>Turn them upside down and repeat.","."],

I added the “followUp” section to the course to enrich the syntax. “followUp” is much easier than course. I reused “job” and “answerWithoutEnd” in this part:

"followUp":["To keep away ants, sprinkle #answerLiquidObject#.", "For #jobNoun#, use #answerLiquidObject#.","#answerLiquidObject.capitalize# will get off #jobNoun#.","To #job#, #answerWithoutEnd#.", "To #job#, you can #answerWithoutEnd##answerAfter#", "For #jobNoun# on #jobPlace#, try to #answerWithoutEnd##answerAfter#","For #jobNoun.s# on #jobPlace#, treat them the same way you treat #jobNoun#.","Even if there's a #jobNoun#, the problem's solved.", "For #jobNoun#, #answerWithoutEnd#.", "This will work just as well to #job#."],

I also added “middle” part, which were some of the commentary sentences that follow the tutorial:

"middle":["The key is #middlePart#.", "The tricky part is #middlePart#.","This is valuable on-the-job training. Feel free to take notes.","Stop me if you already know all this.","These are what I'm up to when #event#.", "These are the basics they teach in Home Economics."],

"middlePart":["keeping your mouth shut","to forget how fast these things can happen. Suicides. Accidents. Crimes of passion.","not to panic","to keep busy"],

Finally, I integrated the various parts in “story”. I added the “setJob” section to make sure that course and answer are handling the same events. And to make sure that the events handled by each sentence are not duplicated because of “setJob”, I re-set them before each sentence.

"story":[ "#GoBack#<br><br>[Object:#jobPlace#]#course#<br>[Object:#jobPlace#]#followUp#[Object:#jobPlace#]<br>#followUp#<br><br>#middle#<br><br>[Object:#jobPlace#]#followUp#[Object:#jobPlace#] #followUp#<br>[Object:#jobPlace#]#followUp#<br><br>#GoBack#"],

"setJob":["[Object:#jobPlace#]"],

Result

Link of the editor: http://tracery.io/editor/

Here’s the code: (is there any other way to save this?) 

Not perfect, but fun. One of them:

I’m Sophia’s enraged heart.

Just ask me how to remove protein-based stains.
No, really, go ahead.
Ask me.
You cover it with weak mixture of water and ammonia.
Turn them upside down and repeat.
To hide protein-based stains on fur coat, sink fur coat into weak mixture of water and ammonia and wiggle them around.
A paste of cornstarch and cold water will get off protein-based stain.

Stop me if you already know all this.

For protein-based stain, use Peppermint oil. Even if there’s a mascara stain, the problem’s solved.
Even if there’s a protein-based stain, the problem’s solved.

I’m Sophia’s weepy, clenching heart.

Leave a Reply

Your email address will not be published. Required fields are marked *