skip to navigation
skip to content

markovwordgen 0.9.6

Markov name/word generator (RPG name generator).

Markov chain generator for random words.

Generates new words based on chains in the existing data. For example if input is cat, dat, drape. When a new word is generated it can start with c (33%) or d (67%). (There are two ds). If a d, the next letter is a (50%) or r (50%). Assuming it’s an a, the next letter must be either p (3%3) or t (67%).

Letter pairs that can start and end a word are special-cased.

As a Python library, feed with source data (list of strings).

>>> mydata = ['aimee', 'alexandra', 'alice' ... ]
>>> word_factory = MarkovWordgen(mydata)
>>> [word_factory.generate() for _ in range(5)]
['juzace', 'hexsene', 'varysarel', 'keynena', 'leely']

If no data supplied it, will default to some elf-like names with too many vowels.

As a console app, arg is a text file, with one word per line.

$ ~/names.txt --quantity 5

Use --help for full CLI docs. There’s some default data in there.

The generator special cases starting and ending letter pairs, so it’s OK if your input data is capitalized.

Are your results bad? Make sure you have a sufficiently long input file. 50 words should do it.

File Type Py Version Uploaded on Size
markovwordgen-0.9.6.tar.gz (md5) Source 2017-04-05 5KB