The following Python script implements a quick-and-dirty word-based Dissociated Press algorithm.
#!/usr/bin/env python2

from whrandom import choice
from sys import stdin
from time import sleep

dict = {}

def dissociate(sent):
    """Feed a sentence to the Dissociated Press dictionary."""
    words = sent.split(" ")
    words.append(None)
    for i in xrange(len(words) - 1):
        if dict.has_key(words[i]):
            if dict[words[i]].has_key(words[i+1]):
                dict[words[i]][words[i+1]] += 1
            else:
                dict[words[i]][words[i+1]] = 1
        else:
            dict[words[i]] = { words[i+1]: 1 }

def associate():
    """Create a sentence from the Dissociated Press dictionary."""
    w = choice(dict.keys())
    r = ""
    while w:
        r += w + " "
        p = []
        for k in dict[w].keys():
            p += [k] * dict[w][k]
        w = choice(p)
    return r

if __name__ == '__main__':
    while 1:
        s = stdin.readline()
        if s == "": break
        dissociate(s[:-1])
    print "=== Dissociated Press ==="
    try:
        while 1:
            print associate()
            sleep(1)
    except KeyboardInterrupt:
        print "=== Enough! ==="

This code may be used from the command line or as a Python module. The command-line handler (the last chunk of code, beginning with if __name__ == '__main__') reads one line at a time from standard input, and treats each line as a sentence. When it reaches EOF, it begins printing one dissociated sentence per second.

The dissociate function stores frequency information about successive words in the global dictionary dict. That is to say: Every word in the input text occurs as a key in dict. The value of dict[foo], for some word foo, is itself a dictionary. It stores the words which have occurred immediately after foo in the source text, and the number of times they have done so. The end of a sentence is represented with the null value None.

The associate function creates a new sentence based on the frequency information in dict. It begins a sentence with a random word from the source text. Next, it uses dict to select a word which, in the original text, followed the first word. The probability of each possible word being selected is based on that word's frequency following the first word in the original text. If the "word" selected is the None value, the sentence is complete; otherwise, it picks a new word that has followed the last.

Here is a sample source text file. Please note the lack of punctuation; this program isn't smart enough to deal with it appropriately.

all your base are belong to us
everything is a base for soy lesbians
are you all monkeys
monkeys lesbians and soy are good for you
now is the time for all good lesbians to come to the aid of their monkeys
good monkeys belong in a zoo
on everything you can meet a zoo full of lesbians

And here is a sample of the output based on these sentences:

meet a zoo full of their monkeys lesbians and soy are you
a zoo full of their monkeys
on everything is the time for soy are good monkeys lesbians
time for all your base for you can meet a base are belong to us
good monkeys belong to us
base are belong to come to us
now is the time for all your base are you can meet a zoo
is a zoo
now is the time for soy are good lesbians and soy are good monkeys belong to the time for all monkeys
full of lesbians
base for all good monkeys
lesbians and soy lesbians to the time for soy lesbians