Skip to main content

Gibi

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

develop:

build-develop

master:

build-master

Usage

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

CLI

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.

API

Basic usage

In its simplest form, using the API looks like:

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

    m.feed(n)

print(m.make_word())

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:
    m.load(f)

print(m.make_word())

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

Metadata

Release files for gibi 0.2.3-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 gibi 0.2.3-1
File Size Uploaded Provenance
gibi-0.2.3-1.tar.gz 7.1 kB Without provenance Details

Release files / gibi-0.2.3-1.tar.gz

Download URL gibi-0.2.3-1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
29bbbc6a9859767663144c78d94421630fadc4cfed0149752aa43cace90783ff
BLAKE2b-256 checksum
How to use checksums
6f86cbf52f728adb39b544f856f16c5b6160134253089770433083f4a89503d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gibi 0.2.3-1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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