Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Project ChanText

Name: !GEJzSATORI 2008-02-17 23:04

'sup /prog/,

Having played with Markov-chain text generators, I came up with the idea of gathering statistics by parsing randomly selected threads from a certain board at periodic intervals, then using those accumulated word frequencies to generate text, which would then have the flavor of the board.

Your thoughts, /prog/?

Name: Anonymous 2011-11-22 13:33

Why overcomplicate things?


import sys
from random import randint

text = sys.stdin.read().split(" ")

words = {}
prev = "","\n"
for word in text:
        if prev in words:
                words[prev].append(word)
        else:
                words[prev] = [word]
        prev = prev[1], word

word = "","\n"
for i in range(10000):
        lst = words[word]
        ran = randint(0, len(lst)-1)
        word = word[1], lst[ran]
        print word[1],

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List