Course Project Option 2: Random Writer

Artificial intelligence is an active and exciting area of computer science. Can computers be made to do tasks that seem "intelligent"? Some of the goals (and partial successes) of artificial intelligence include important areas such as medical diagnosis, drug discovery, and robotics. For this assignment, we will visit the part of artificial intelligence referred to as "natural language processing," i.e. getting a computer to work with a natural language such as English.

More specifically, write a program called RandomWriter that will actually write original prose in the style of a chosen human author. Can computers be creative? We'll find out!

Details

Find a source text. Specifically, find a text file that contains some text that you want the computer to creatively imitate. Project Gutenberg is a great place to start.

The technique that you will use works conceptually as follows:

Here's an example of some text that my program generates, using a window size of 5 on Grimm's fairy tales:

I will you learn home to taken his way, and around him, and left his come intender him in they cried: 'The little child,' said the other; 'let us for the cloak, and brough the peasant was to King.

Alternatively, when I tried it with a window size of 8, here's what I got one of the times that I ran it:

The servants running across the stables to salt and butter to eat and drink, the head you must get up quickly, and fell fainting to the test.

Final notes

Make sure that you use good design. Think carefully about how to layout your program so that your methods remain short and self-contained.


Many thanks to Joe Zachary for the idea!