A Fantastical Dream: NaNoGenMo 2018

For the past few weeks, I have been working on one of the biggest projects yet! This time, I had to write code with Python in order to produce a novel that was at least 50,000 words. It seemed like a terrifying task at first, and I had no idea where to start. At first, I thought about searching for crime reports for famous crimes such as those of O.J. Simpson, the Menendez brothers, etc. I love ‘true-crime’ shows and documentaries. When I discovered that this would not be possible, I thought about using scripts from my favorite movies such as The Parent TrapThe Proposal, and more! I could find the scripts very easily, however I knew that it would give me a strange format as the scripts included the names of the characters and then their line. So it might look something like:



I wasn’t sure then about that idea. I then turned to another great idea! I thought back to my Remix poem where I combined famous quotes from three famous shows. I decided to grab chapters, quotes, and one entire book and combine them all in order to create my novel! The books ended up using were Alice in Wonderland, The Secret Garden, Cinderella, Mary Poppins, Nancy Drew, Paper Towns, The Wizard of Oz, Thirteen Reasons Why, and You’re a Badass. Some were very difficult to find online. For Mary Poppins, I sat at my computer for about an hour typing Chapter 1 by hand. Other ones, I was able to copy and paste. For example, books like Nancy DrewThe Secret Garden, and Alice in Wonderland were able to be copied and pasted quite easily. This is the time where I will tell you that I do not own any of these books. I did not write them; I am only using them as sources for my novel. All credit goes to the original authors.

Now that I had all of the text, I copied and pasted it into a Word document to see the actual word count. I’m pretty sure I ended up with something close to 54,000 words. Once I had each text file for each book, I then decided the easiest option would be to combine all of the text files into one main text file, which I named ‘Stories.txt.’ I’m not too sure why I didn’t do this to begin with.

Now it was time to write the code! This was the part I was most dreading. Luckily, by the time I had started the code, Dr. Whalen had walked us through a couple of examples in class and he had already posted three videos to walk us through everything we needed to know. I imported ‘markovify’ from Github. This was going to be perfect because I knew this would help give me some very odd, funny sentences. I followed the Github page for ‘markovify’ and soon enough after using the code that they displayed as a template, I had my novel! Now it was time to clean it up and format it better. I also needed to convert it to a PDF file. In order to do so, I followed Dr. Whalen’s instructions and imported ‘dominate’ and ‘pdfkit’ from Github. I had completed the code, however I had begun to receive numerous errors. I felt so frustrated.

In class, I asked Dr. Whalen for help and he cleared everything up! I had basically “overwhelmed” Python as it is not necessarily capable of printing out as much as I wanted it to. I originally had it printing 50,000 sentences rather than 50,000 sentences. I also had to download ‘Homebrew’ and ‘wkhtmltopdf’ to my computer in order for everything to process correctly. Once these two pieces of software were downloaded to my computer and the amount of requested sentences was brought down to 3500 instead of 50,000, I had my novel! Then, thanks to a classmate’s help, I used the function in order for me see how many words my novel actually was. I have to say that I hit ‘run’ a few times as I did import random at the beginning. After hitting ‘run’ a few times, I had a novel I liked the most. After running the length function, it turns out that the novel is 54,675 words.

Now that I had everything set up, code wise, I needed to come up with a title. I decided to name my novel A Fantastical Dream because I feel as though I included all of these books that include fairytales and fictional aspects. (I added You’re a Badass as my dad gave it to me for Christmas and there were some very positive quotes in it that I wanted to use!)

My code and full novel PDF are uploaded to my Github repository, however it is also linked below!

The repository, itself 

The text file that contains all of the book excerpts 

The code! 



Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.