skip to navigation
skip to content

Not Logged In

gibi 0.2.1

Generate random words based on Markov chains

Latest Version: 0.2.3-1

Gibi is a random word generator, based on Markov chains.

It analyzes a text in order to deduce the probability of transition from one character to another, and then generates a completely random word that will look alike what you have feeded it as input.

Build status



Gibi can be used either as a CLI tool, either as a library.


A tool named gibi helps you to generate a matrix file, and then use it to generate words. It is self-documented using the –help switch, however here is a typical workflow.

$ gibi analyze corpus.txt matrix.gibi
$ gibi generate matrix.gibi

This will analyze the corpus.txt file into the matrix.gibi file, and then produce 10 random words.


Basic usage

In its simplest form, using the API looks like:

with, 'r', encoding='utf-8') as f:
    n = FrenchNormalizer(f)
    m = Matrix()



You can also make something deterministic by providing a seed to make_word(). Given the same Matrix and the same seed, you will always get the same result. The provided seed is anything that Python’s random would accept. See the following example:

assert m.make_word(42) == m.make_word(42)

Using matrix files

You will probably pre-generate a matrix file using gibi analyze, and then load the resulting file like this

m = Matrix()
with open('matrix.gibi', 'rb') as f:


This is much more performant, as generating the matrix can be time-consuming if the corpus is big.

File Type Py Version Uploaded on Size
gibi-0.2.1.tar.gz (md5) Source 2014-03-03 6KB
  • Downloads (All Versions):
  • 18 downloads in the last day
  • 129 downloads in the last week
  • 500 downloads in the last month