Lorem Ipsum

New in version 0.7.

This function produces Lorem Ipsum - a placeholder text.

More information can be found at https://en.wikipedia.org/wiki/Lorem_ipsum

Example Usage

Note: the output of Lorem Ipsum is random, thus you can see a slightly different output on your machine.

One sentence with 10 words:

>>> signalz.lorem_ipsum.get_sentence(words=10)
Ultrices pulvinar nisl fringilla laoreet nostra eget enim elementum nibh.

One sentence with custom dictionary:

>>> d = ["mouse", "rat", "shark", "sheep", "cat", "dog"]
>>> signalz.lorem_ipsum.get_sentence(dictionary=d)
Shark mouse sheep mouse rat cat dog.

One sentence created with included english dictionary:

>>> d = ["mouse", "rat", "shark", "sheep", "cat", "dog"]
>>> signalz.lorem_ipsum.get_sentence(dictionary=d)
Went how here give after give there.

Text (one paragraph) with 50 words.

content = signalz.lorem_ipsum.get_text(words=50)

Text (one paragraph) with 50 words and custom sentence size - note that the last sentence can have less words to match the given words count:

content = signalz.lorem_ipsum.get_text(words=50, words_per_sentence=4)

Text with paragraphs:

content = signalz.lorem_ipsum.get_paragraphs()

Fully customized text with paragraphs:

content = signalz.lorem_ipsum.get_paragraphs(words=1000, paragraphs=3, words_per_sentence=5, dictionary=my_custom_list_of_words)

Function Documentation

signalz.generators.lorem_ipsum.get_dictionary(dictionary)[source]

This function checks what word list is desired for Lorem Ipsum.

Kwargs:

  • dictionary : options are:
    • “english” (str) for english words,
    • “standard” (str) for latin words,
    • any list obtaining strings (list) - for custom words

Returns:

  • list of words
signalz.generators.lorem_ipsum.get_paragraphs(words=300, paragraphs=5, words_per_sentence=7, dictionary='standard')[source]

This function generates text with multiple paragraphs (newlines). The total number of words is divided between paragraphs as evenly as possible.

Kwargs:

  • words : number of desired words
  • paragraphs : number of desired paragraphs
  • words_per_sentence : prefered number of words in sentence
  • dictionary : options are:
    • “english” (str) for english words,
    • “standard” (str) for latin words,
    • any list obtaining strings (list) - for custom words

Returns:

  • text made of multiple sentences (str)
signalz.generators.lorem_ipsum.get_sentence(words=7, dictionary='standard')[source]

This function returns one sentence of lorem ipsum.

Kwargs:

  • words : number of desired words
  • dictionary : options are:
    • “english” (str) for english words,
    • “standard” (str) for latin words,
    • any list obtaining strings (list) - for custom words

Returns:

  • sentence (str)
signalz.generators.lorem_ipsum.get_text(words=150, words_per_sentence=7, dictionary='standard')[source]

This function generates text (paragraph). Last sentence can be shorter than requested if there is not enough words left.

Kwargs:

  • words : number of desired words
  • words_per_sentence : prefered number of words in sentence
  • dictionary : options are:
    • “english” (str) for english words,
    • “standard” (str) for latin words,
    • any list obtaining strings (list) - for custom words

Returns:

  • text made of multiple sentences (str)