Skip to content

Ceasar/nonsense

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Info

A stationary source object, suitable for creating sequences of random data with fixed conditional probabilities.

Example Usage

Usage is pretty simple. Just instantiate the source with some data and let it produces sequences for you.

from nonsense import StationarySource


def get_lines():
    with open("bruces.txt") as f:
        for line in f:
            yield line.split()


if __name__ == "__main__":
    lines = list(get_lines())
    g = StationarySource(lines, 1)
    for _ in range(10):
        print " ".join(list(g.generate_sequence()))

And in just 14 lines, we're on our way to starting the next great comedy troupe.

Hot enough to boil a monkey's bum in here, Bruce.
Well Bruce, I heard the philosophy department at the University of Walamaloo.
Blimey, it's hot enough to herself.
That's a strange expression, Bruce.
Blimey, it's hot in here, your Majesty," he said and she smiled quietly to introduce man from Pommeyland who is joinin' us this year in here, Bruce.
Bruce.
Where's Bruce?
Blimey, it's hot in the philosophy department at all stuck up.
Bruce.
He's not 'ere, Bruce.

About

Simple Markov chain babbler for Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages