lorem_ipsum module — fabulist 1.2.0 documentation

# lorem_ipsum module

3. 2017 Martin Wendt; see https://github.com/mar10/fabulist

Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

class `fabulist.lorem_ipsum.` `LoremGenerator`(data_folder)

  Bases: `object`

  Generate lorem ipsum text in a given dialect.

  `dialect_map`

    dict(dialect, LoremDialect) – Holds all available lorem-ipsum dialects

  `generate_paragraphs`(count=None, dialect='ipsum', entropy=2, keep_first=False, words_per_sentence=(3, 15), sentences_per_para=(2, 6))

    Generate a number of paragraphs, made up from random sentences.

    Parameters: | count (int, optional) – Number of paragraphs. Pass None for infinite. Default: None. dialect (str, optional) – For example “ipsum”, “pulp”, “trappatoni”. Pass None to pick a random dialect. Default: “ipsum”. keep_first (bool, optional) – Always return the first sentence as first result. Default: False. entropy (int) – 0: iterate original text 1: pick a random paragraph, then use it literally 2: mix a random sentences 3: mix random words Default: 2. words_per_sentence (int or tuple(min, max), optional) – Number of words per sentence. This argument is only used for entropy=3. Default: (3, 15). sentences_per_para (int or tuple(min, max), optional) – Number of sentences per paragraph. Default: (2, 6).
    Yields: | str – Random paragraph.

  `generate_sentences`(count=None, dialect='ipsum', entropy=2, keep_first=False, words_per_sentence=(3, 15))

    Yield <count> random sentences.

    Parameters: | count (int, optional) – Number of sentences. Pass None for infinite. Default: None. dialect (str, optional) – For example “ipsum”, “pulp”, “trappatoni”. Pass None to pick a random dialect. Default: “ipsum” (i.e. lorem-ipsum). entropy (int, optional) – 0: iterate sentences from original text 1: pick a random paragraph, then iterate sentences 2: pick a random sentence 3: mix random words Default: 2. keep_first (bool, optional) – Always return the first sentence as first result. Default: False. words_per_sentence (int or tuple(min, max), optional) – Number of words per sentence. This argument is only used for entropy=3. Default: (3, 15).
    Yields: | str – Random sentence.

  `generate_words`(count=None, dialect='ipsum', entropy=3, keep_first=False)

    Yield <count> random words.

    Parameters: | count (int, optional) – Number of words. Pass None for infinite. Default: None. dialect (str, optional) – For example “ipsum”, “pulp”, “trappatoni”. Pass None to pick a random dialect. Default: “ipsum” (i.e. lorem-ipsum). entropy (int, optional) – 0: iterate words from original text 1: pick a random paragraph, then use it literally 2: pick a random sentence, then use it literally 3: pick random words Default: 3. keep_first (bool, optional) – Always return the words of the first sentence as first result. Default: False.
    Yields: | str – Random word.