π Documentation & API Usageο
The arrand.arrandom
module provides simple functions to retrieve random Arabic texts across various categories.
π§ Available Functionsο
Function |
Description |
Supports Vocalized |
---|---|---|
|
Returns a random Quranic verse |
β |
|
Returns a random Hadith |
β |
|
Returns a random literary phrase |
β |
|
Returns a random Arabic proverb |
β |
|
Returns a random line of poetry |
β |
|
Returns a random paragraph |
β |
|
Returns a single random Arabic word |
β |
|
Generic text selector by category |
β |
|
Returns multiple lines from category |
β |
|
Generates a nonsense sentence |
β |
|
Generates multiple nonsense lines |
β |
π Example: Get One Text from Each Categoryο
import arrand.arrandom as rnd
print(rnd.aya())
print(rnd.hadith())
print(rnd.proverb())
print(rnd.phrase())
print(rnd.word())
print(rnd.poem())
print(rnd.paragraph())
π Example: Get Vocalized Dataο
print(rnd.aya(vocalized=True))
print(rnd.sample("text", max_length=2, vocalized=True))
π¦ Example: Generate Nonsense Sentencesο
print(rnd.rand_sentence())
print(rnd.rand_sentences(3))
ποΈ Categories Availableο
"aya"
"hadith"
"phrase"
"proverb"
"poem"
"paragraph"
"word"
"text"
To retrieve multiple lines, use:
rnd.sample(category="poem", max_length=2)
To get a single random line:
rnd.select("proverb")
Generate samples with word count control
rnd.arrandom.sample(category="text", max_length=3, min_words=9, max_words=20)
π₯οΈ Command Line Interface (CLI)ο
Once installed, you can use arrand
directly from the command line:
π§ Basic usageο
```bash
arrand
Outputs a random Arabic text from the βtextβ category.
ποΈ Select a specific categoryο
arrand --category aya
arrand --category hadith
arrand --category phrase
arrand --category poem
arrand --category proverb
arrand --category paragraph
arrand --category word
π’ Generate multiple entriesο
Use -n
or --number
to control how many items to generate:
arrand -c poem -n 3
arrand -c phrase -n 5
π€ Enable vocalization (tashkeel)ο
arrand -c hadith --vocalized
π€ͺ Generate nonsense sentencesο
arrand --category nonsense
arrand -c nonsense -n 2
βοΈ Filter text by lengthο
arrand --category poem --min-words 5 --max-words 10
arrand --category phrase --max-chars 120
π Show helpο
arrand --help