YOU ALL SUCK!

Raymond Hettinger vze4rx4y at verizon.net
Tue Sep 7 06:19:15 EDT 2004


> I was curious, so I googled for "CHOMSKY is an aid to writing linguistic
papers in the style"
> and found the lisp source:
>
>     http://www-personal.umich.edu/~jlawler/foggy.lsp

For those who are interested, here is the engine translated into Python (use the
original url to capture the part lists or roll your own):

import textwrap, random

def format_wisdom(text):
    return textwrap.fill(text, line_length)

def chomskey(times = 1):
    if not isinstance(times, int):
        return format_wisdom(__doc__)
    prevparts = []
    newparts = []
    output = []
    for i in xrange(times):
        for partlist in (leadins, subjects, verbs, objects):
            while 1:
                part = random.choice(partlist)
                if part not in prevparts:
                    break
            newparts.append(part)
        output.append(' '.join(newparts))
        prevparts = newparts
        newparts = []
    return format_wisdom('  '.join(output))

print chomskey(5)



Raymond Hettinger









More information about the Python-list mailing list