For my first assignment in Reading and Writing Electronic Text, I set out to explore making a Python script that would provide a brief glimpse into a novel. In my early experiments with some of the sample scripts, I was able to use the ngram counter with a UNIX grep on Walden to produce “I came to the woods, I lived in the woods.” I found that to be a nice little summation of Walden, and wanted to try exploring that further.
Ultimately, I ended up trying so many different things that I could never get a full program working correctly the way I wanted. The program prompts you to select a .txt file of your choosing, then runs the Python script below on it.
One of the outputs I got from running this text against Walden is:
filling the surrounding woods with circling and dilating sound, stirring
the instinct of the chase? or the lost pig which is said to be in these
indispensable to every man. If your trade is with the Celestial Empire,
accumulated what is called “a handsome property”–though I never got a
many and weighty, and deserve to prevail, may also at last be brought
because of any ill effects which I had traced to them, as because they
which had no other motive or excuse but that I might pay for it and
it unconsciously, like the brutes, of our mothers. The other is the
travelling gradually down in my studies through that accidental souring
saint dwell there so long. Birds do not sing in caves, nor do doves
Another, from The Sun Also Rises:
opened the letter. It had been forwarded from Pamplona. It was dated San Sebastian, Sunday:
“Will you send her up, please?”
“Come on, Robert,” Bill said.
“All right,” Bill said. “Where shall we go?”
groggy now. There was only a bad headache. Everything looked sharp and clear, and the town smelt of the early
“I’d tell her, too,” said the count. “I’m not joking you. I never joke people. Joke people and you make enemies.
“Sure, you could marry anybody.”
I’m not terribly happy with any of these, and am going to continue working on it before class, but I wanted something up for a post.