smart-text-randomizer
Smart Text Randomizer
Create different variations of the same message using special syntax with curly braces and vertical bars.
smart-text-randomizer — "Text randomization" or "variable text". It is used to create different variations of the same message.
You are using special syntax. Example: '{Salute|Hello|Good morning} {comrade|buddy|dear friend}!'
This syntax allows you to create variable messages by using curly braces and vertical bars to indicate alternatives.
- Variable Text Generation — create message variations
- Curly Brace Syntax —
{option1|option2|option3} - Multiple Groups — use multiple randomization groups in one message
- Lightweight — minimal dependencies
- Simple API —
TextRandomizer.randomize(text)
Basic elements of syntax:
-
Curly braces {}
Used to group text options. Anything inside the curly braces will be randomly selected when generating the text. -
Vertical bar |
Used to separate different text options within curly braces. Each option will be treated as a separate choice.
| Syntax Element | Description |
|---|---|
{...} | Group text options for random selection |
| | Separate different options within braces |
Syntax:
'{Salute|Hello|Good morning} {comrade|buddy|dear friend}!'
Possible results:
- Salute comrade!
- Salute buddy!
- Salute dear friend!
- Hello comrade!
- Hello buddy!
- Hello dear friend!
- Good morning comrade!
- Good morning buddy!
- Good morning dear friend!
- Create your text: Identify which parts of your message can vary and place them in curly braces.
- Add options: Separate alternatives with a vertical bar.
- Text Generation: Use
TextRandomizer.randomize()to generate a random message.
Notes:
- Make sure all options inside the curly braces make sense and fit the context.
- You can use multiple randomization groups in a single message to create more complex variations.
pip install smart-text-randomizer
Example of text randomization:
from smart_text_randomizer import TextRandomizer
text_randomizer = TextRandomizer()
text = '{Salute|Hello|Good morning} {comrade|buddy|dear friend}!'
randomized_text = TextRandomizer.randomize(text)
print(randomized_text) # Good morning buddy!
By using this software, you agree to the full disclaimer terms.
Software provided "AS IS" without warranty. You assume all risks.
Full legal disclaimer: See DISCLAIMER.md
License: BSD 3-Clause License