YOU ALL SUCK!

Carl Scharenberg carl.scharenberg at gmail.com
Tue Sep 7 17:32:44 EDT 2004


This thread has become useful! (not to mention whimsical). Thanks for the program.

Carl


"Raymond Hettinger" <vze4rx4y at verizon.net> wrote in message news:<DWf%c.1510$%N6.1056 at trndny01>...
> > 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