Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Another text generator based on Markov chains.

Project Description

Installation

Using pip:

  • pip3 install markovgen –user

Or

From the git repository:

Command-line usage

Usage:
python3 -m markovgen <extracter> <path to log file>

Supported extracters are:

  • srt
  • supybot
  • weechat
  • xchat
  • plain

Usage as a library

markovgen.Markov:
__init__(messages=[]):
takes an optional list of initial messages.
feed(message):
takes a message and adds it to the cache.
feed_from_file(file_descriptor, extracter):
Reads the file descriptor line by line, apply the extracter to it, and feeds the cache with the return value of the extracter.
generate_markov_text(max_size=30, seed=None, backward=False):
Generate a text based on the cache. Selects a random word in the cache as the first (resp. last) word, and continues forward (resp. backward) using the cache in the right direction, until it selects a message end from the cache or that the max_size is met. The seed may be a string or a 2-tuple of strings.
available_seeds(backward=False):
Returns a view on the 2-tuples of words in the corpus. Useful if you want to match them against a new message.
@mixed_encoding_extracting:
decorator for extracters that handle decoding messages with the right charset (if chardet or charade is installed) or as utf8 (otherwise)
Release History

Release History

This version
History Node

0.5

History Node

0.4.1

History Node

0.4

History Node

0.3.1

History Node

0.3

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
markovgen-0.5.tar.gz (3.6 kB) Copy SHA256 Checksum SHA256 Source Mar 3, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting