Locale la

faker.providers.lorem

class faker.providers.lorem.la.Provider(generator)

Bases: faker.providers.lorem.Provider

Implement lorem provider for la locale.

paragraph(nb_sentences=3, variable_nb_sentences=True, ext_word_list=None)

Generate a paragraph.

The nb_sentences argument controls how many sentences the paragraph will contain, and setting variable_nb_sentences to False will generate the exact amount, while setting it to True (default) will generate a random amount (+/-40%, minimum of 1) using randomize_nb_elements().

Under the hood, sentences() is used to generate the sentences, so the argument ext_word_list works in the same way here as it would in that method.

Sample:nb_sentences=5
Sample:nb_sentences=5, variable_nb_sentences=False
Sample:nb_sentences=5, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
Sample:nb_sentences=5, variable_nb_sentences=False, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
paragraphs(nb=3, ext_word_list=None)

Generate a list of paragraphs.

This method uses paragraph() under the hood to generate paragraphs, and the nb argument controls exactly how many sentences the list will contain. The ext_word_list argument works in exactly the same way as well.

Sample:nb=5
Sample:nb=5, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
sentence(nb_words=6, variable_nb_words=True, ext_word_list=None)

Generate a sentence.

The nb_words argument controls how many words the sentence will contain, and setting variable_nb_words to False will generate the exact amount, while setting it to True (default) will generate a random amount (+/-40%, minimum of 1) using randomize_nb_elements().

Under the hood, words() is used to generate the words, so the argument ext_word_list works in the same way here as it would in that method.

Sample:nb_words=10
Sample:nb_words=10, variable_nb_words=False
Sample:nb_words=10, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
Sample:nb_words=10, variable_nb_words=True, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
sentences(nb=3, ext_word_list=None)

Generate a list of sentences.

This method uses sentence() under the hood to generate sentences, and the nb argument controls exactly how many sentences the list will contain. The ext_word_list argument works in exactly the same way as well.

Sample:
Sample:nb=5
Sample:nb=5, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
text(max_nb_chars=200, ext_word_list=None)

Generate a text string.

The max_nb_chars argument controls the approximate number of characters the text string will have, and depending on its value, this method may use either words(), sentences(), or paragraphs() for text generation. The ext_word_list argument works in exactly the same way it would in any of those methods.

Sample:max_nb_chars=20
Sample:max_nb_chars=80
Sample:max_nb_chars=160
Sample:ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
texts(nb_texts=3, max_nb_chars=200, ext_word_list=None)

Generate a list of text strings.

The nb_texts argument controls how many text strings the list will contain, and this method uses text() under the hood for text generation, so the two remaining arguments, max_nb_chars and ext_word_list will work in exactly the same way as well.

Sample:nb_texts=5
Sample:nb_texts=5, max_nb_chars=50
Sample:nb_texts=5, max_nb_chars=50, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
word(ext_word_list=None)

Generate a word.

This method uses words() under the hood with the nb argument set to 1 to generate the result.

Sample:
Sample:ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
words(nb=3, ext_word_list=None, unique=False)

Generate a list of words.

The nb argument controls the number of words in the resulting list, and if ext_word_list is provided, words from that list will be used instead of those from the locale provider’s built-in word list.

If unique is True, this method will return a list containing unique words. Under the hood, random_sample() will be used for sampling without replacement. If unique is False, random_choices() is used instead, and the list returned may contain duplicates.

Warning

Depending on the length of a locale provider’s built-in word list or on the length of ext_word_list if provided, a large nb can exhaust said lists if unique is True, raising an exception.

Sample:
Sample:nb=5
Sample:nb=5, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’]
Sample:nb=4, ext_word_list=[‘abc’, ‘def’, ‘ghi’, ‘jkl’], unique=True