Skip to content

mar10/fabulist

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
January 1, 2018 11:32
September 21, 2021 21:27
September 21, 2021 21:27
December 30, 2017 22:07
October 18, 2020 22:41
September 21, 2021 21:28
January 1, 2018 11:32
August 1, 2017 12:27
January 1, 2018 13:18
September 21, 2021 21:27
September 21, 2021 21:27
September 21, 2021 21:28
December 30, 2017 22:07
August 28, 2017 21:31
September 21, 2021 21:27
August 1, 2017 12:27
January 1, 2018 13:18
September 21, 2021 21:27
September 21, 2021 21:28

Fabulist

Powered by You Build Status Latest Version License Documentation Status

Generate meaningful test data based on string templates.

Usage

$ pip install fabulist

then

from fabulist import Fabulist

fab = Fabulist()

templates = [
    "$(Verb:ing) is better than $(verb:ing).",
    "$(Noun:an) a day keeps the $(noun:plural) away.",
    "If you want to $(verb) $(adv), $(verb) $(adv)!",
    'Confucius says: "The one who wants to $(verb) must $(verb) $(adv) the $(noun)!"',
    ]
print("Fortune cookies:")
for q in fab.generate_quotes(templates, count=10):
    print("- ", q)

will produce something like

Fortune cookies:
-  A statement a day keeps the airports away.
-  Savoring is better than magnifying.
-  If you want to sate divisively, disuse calmly!
-  Praying is better than inspecting.
-  Confucius says: "The one who wants to sterilize must inform miserably the possibility!"
-  If you want to blur orderly, stride poorly!
-  A cost a day keeps the gears away.
-  Subtracting is better than worshipping.
-  If you want to damage solely, discuss jealously!
-  Confucius says: "The one who wants to vanish must swear terribly the punch!"

See also the Introduction Slides and Read The Docs for details.