0
# Text and Content Generation
1
2
Generate textual content including words, sentences, paragraphs, colors, and various text-based data with locale-appropriate content for content creation and testing.
3
4
## Capabilities
5
6
### Text Generation
7
8
```python { .api }
9
class Text(BaseDataProvider):
10
def word(self) -> str:
11
"""Generate a single word."""
12
13
def words(self, quantity: int = 5) -> list[str]:
14
"""Generate list of words."""
15
16
def sentence(self) -> str:
17
"""Generate a sentence."""
18
19
def text(self, quantity: int = 5) -> str:
20
"""Generate paragraph with specified sentence count."""
21
22
def title(self) -> str:
23
"""Generate a title."""
24
25
def quote(self) -> str:
26
"""Generate a quote."""
27
28
def answer(self) -> str:
29
"""Generate yes/no answer."""
30
```
31
32
### Visual Content
33
34
```python { .api }
35
class Text(BaseDataProvider):
36
def color(self) -> str:
37
"""Generate color name like 'red', 'blue'."""
38
39
def hex_color(self, safe: bool = False) -> str:
40
"""Generate hex color code like '#FF5733'."""
41
42
def rgb_color(self, safe: bool = False) -> tuple[int, ...]:
43
"""Generate RGB color tuple like (255, 87, 51)."""
44
45
def emoji(self, category: EmojyCategory = EmojyCategory.DEFAULT) -> str:
46
"""Generate emoji character."""
47
```
48
49
### Alphabet and Character Data
50
51
```python { .api }
52
class Text(BaseDataProvider):
53
def alphabet(self, lower_case: bool = False) -> list[str]:
54
"""Generate alphabet letters."""
55
56
def level(self) -> str:
57
"""Generate level indicator."""
58
```
59
60
## Usage Examples
61
62
```python
63
from mimesis import Text
64
from mimesis.enums import EmojyCategory
65
66
text = Text()
67
68
# Text generation
69
content = {
70
'title': text.title(),
71
'paragraph': text.text(quantity=3),
72
'words': text.words(quantity=10),
73
'quote': text.quote()
74
}
75
76
# Color data
77
colors = {
78
'name': text.color(),
79
'hex': text.hex_color(),
80
'rgb': text.rgb_color(),
81
'safe_hex': text.hex_color(safe=True)
82
}
83
84
# Emojis
85
emoji_smile = text.emoji(EmojyCategory.SMILEYS_EMOTION)
86
emoji_food = text.emoji(EmojyCategory.FOOD_DRINK)
87
```