Crate lipsum[−][src]
Expand description
Lorem ipsum generator.
This crate generates pseudo-Latin lorem ipsum placeholder text. The traditional lorem ipsum text start like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
This text is in the LOREM_IPSUM
constant. Random looking text
like the above can be generated using the lipsum
function. The
function allows you to generate as much text as desired and each
invocation will generate different text.
The random looking text is generated using a Markov chain of
order two, which simply means that the next word is based on the
previous two words in the input texts. The Markov chain can be
used with other input texts by creating an instance of
MarkovChain
and calling its learn
method.
Structs
MarkovChain | Simple order two Markov chain implementation. |
Words | Never-ending iterator over words in the Markov chain. |
Constants
LIBER_PRIMUS | The first book in Cicero’s work De finibus bonorum et malorum (“On
the ends of good and evil”). The lorem ipsum text in
|
LOREM_IPSUM | The traditional lorem ipsum text as given in Wikipedia. Using
this text alone for a Markov chain of order two doesn’t work very
well since each bigram (two consequtive words) is followed by just
one other word. In other words, the Markov chain will always
produce the same output and recreate the lorem ipsum text
precisely. However, combining it with the full text in
|
Functions
lipsum | Generate |
lipsum_title | Generate a short lorem ipsum text with words in title case. |
lipsum_words | Generate |
lipsum_words_from_seed | Generate |
Type Definitions
Bigram | A bigram is simply two consecutive words. |