Lorem Text Generator
The `lorem` library (version 0.1.1) is a lightweight Python package designed to generate random text that resembles Latin, commonly known as 'Lorem Ipsum'. It provides simple functions for generating words, sentences, and paragraphs, as well as a more configurable class for advanced text generation. The project has not seen updates since 2016, indicating a stable but inactive development cadence.
Warnings
- gotcha The `lorem` package (0.1.1) has not been updated since June 2016. While functional for basic needs, it lacks modern features, ongoing maintenance, and explicit Python 3.6+ compatibility statements beyond its initial release era (Python 3.3, 3.4, 3.5). Users requiring active development or extensive features should consider alternative libraries.
- gotcha There are multiple Python packages available on PyPI with 'lorem' or 'lorem ipsum' in their names (e.g., `lorem_text`, `pyloremgen`, `lipsum`, `loremipsum`). Ensure you are installing and importing the correct package (`pip install lorem`) to avoid unexpected behavior or compatibility issues.
- gotcha The `lorem` library's `TextLorem` class offers customization options like `wsep` (word separator), `srange` (sentence length range), and `words` (custom word list). Failing to properly format `words` as a list of strings (e.g., `"A B C".split()`) can lead to unexpected output or errors.
Install
-
pip install lorem
Imports
- lorem
import lorem
- TextLorem
from lorem.text import TextLorem
Quickstart
import lorem
from lorem.text import TextLorem
# Simple usage
sentence = lorem.sentence()
paragraph = lorem.paragraph()
text = lorem.text()
print(f"Sentence: {sentence}")
print(f"Paragraph: {paragraph}")
print(f"Text (multiple paragraphs): {text}")
# Complex usage with TextLorem for custom generation
custom_lorem = TextLorem(wsep='-', srange=(2,3), words="alpha beta gamma delta".split())
custom_sentence = custom_lorem.sentence()
print(f"Custom sentence: {custom_sentence}")