Home For Fiction – Blog

for thinking people


July 17, 2018

GhostWriter: a Random Text Generator App for Android

Literature, Programming

Android, computer, programming, writing

Please note that none of my Android apps is any longer maintained – and they’re not even available on Google Play anymore – for reasons you can read about here. If you still have any of the Home for Fiction Android apps installed on your phone, you’re advised to uninstall them. The post below should be seen purely as a snapshot of history.

I recently talked about the importance of learning how to learn. I spoke of how knowledge should be holistic, with each learned discipline or area of knowledge supporting the rest. Well, let me ask you: Can a guy with a PhD in English literature design Android apps? The answer is GhostWriter, a random text generator Android app I developed.

Long-term readers of this blog probably know that I enjoy programming, particularly when it’s related to writing and literature. Besides my genre-marking JavaScript program, I’ve also experimented with an iambic pentameter generator. Ghostwriter is an app of a similar kind, that is, one concerned with writing and texts.

How Does a Random Text Generator Work?

The GhostWriter app deploys the RiTa library (probably well known to developers). It can generate text based on Markov chain creation. In very simple terms, the program scans some pre-installed texts (mostly older, out-of-copyright novels) and detects how words follow one another.

For example, if there are two phrases like “The black cat went into the market” and “the white dog went into the store”, the app can mix them so that a new, randomly generated phrase emerges: “The black dog went into the market”.

Of course these are only two very simplistic examples. With literally thousands and thousands of combinations, a random text generator can produce some wild results. Here’s just one funny example from A Christmas Carol, by Charles Dickens:

GhostWriter - random text generator
Charles Dickens must be rolling over in his grave. Or, who knows, perhaps he’d find it hilarious and entertaining.