Skip to main content

Vokram is a toy Markov chain library that is most likely implemented incorrectly and extremely inefficiently.

Installation

Use pip to install:

pip install vokram

Usage

Command Line Usage

Pipe a body of text into vokram and it will generate some (hopefully) plausible sentences synthesized from that body of text:

$ cat the_art_of_war.txt | vokram
Spies cannot be obtained inductively from experience, nor by any danger.

You can control the maximum number of words in the output and the n-gram size used when building the Markov model. All command line options are given below:

$ vokram --help

Outputs:

usage: vokram [-h] [-w NUM_WORDS] [-n NGRAM_SIZE]

Generates plausible new sentences from a corpus provided on STDIN.

optional arguments:
  -h, --help            show this help message and exit
  -w NUM_WORDS, --num-words NUM_WORDS
                        Maximum number of words in the resulting sentence.
  -n NGRAM_SIZE, --ngram-size NGRAM_SIZE

Library Usage

Vokram can also be used as a plain old Python library:

>>> import vokram
>>> corpus = open('the_art_of_war.txt')
>>> model = vokram.build_word_model(corpus, 2)
>>> vokram.markov_words(model, 25))
'Hence it is not supreme excellence; supreme excellence consists in breaking the enemy's few.'

Credits

Vokram was made with inspiration from this simple and approachable Python implementation and explanation.

Release files for vokram 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vokram 1.0.1
File Size Uploaded
vokram-1.0.1.tar.gz 6.0 kB Details

Release files / vokram-1.0.1.tar.gz

Download URL vokram-1.0.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d2a6972a587feb47c2f8ab441a8d9814710953af8575207ff2bb82613e0c5334
BLAKE2b-256 checksum
How to use checksums
f299467a90fe6186242f2363468f51b66babe70b72e505f36cb92c4902bd6481
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page