Find a trending topic along the lines of #YinXwords and tweet a random X-word sentence from Project Gutenberg.
See it in action at @inXwords and some of the best at http://favstar.fm/users/inXwords.
Inspired by Darius Kazemi's #FiveWordsToRuinADate, and GenGen, with which I made this prototype. I like that Darius's generators are powered by his gutencorpus, which was inspired by my gutengrep, and gutengrep is used here. Full circle!
First we need some lists of sentences from Project Gutenberg. For this I used a tool called gutengrep on the August 2003 CD ("contains 600 of our best Ebooks").
- Put all Gutenberg text files in the same directory and
cd
to it. gutengrep.py "^\w+\s\w+\s\w+[\.?\!]$" --cache > /tmp/3.txt
edit /tmp/3.txt
- Edit out guff at start and end
sort /tmp/3.txt | uniq > /tmp/3-word-sentences.txt
- Repeat for four, five and six-word sentences.
wc -l /tmp/*.txt
23949 /tmp/3-word-sentences.txt
91551 /tmp/3.txt
31396 /tmp/4-word-sentences.txt
107418 /tmp/4.txt
29835 /tmp/5-word-sentences.txt
94720 /tmp/5.txt
8. Then create a new Twitter application, a new Twitter account, authorise them using this or that, fill in the keys in inxwords.yaml, and run something like:
python inxwords.py --no-web --loop --yamp /path/to/inxwords.yaml --sendir /path/to/dir/of/gutenberg/sentences