πŸ“š Documentation & API Usage

The arrand.arrandom module provides simple functions to retrieve random Arabic texts across various categories.

🧠 Available Functions

Function

Description

Supports Vocalized

aya()

Returns a random Quranic verse

βœ…

hadith()

Returns a random Hadith

βœ…

phrase()

Returns a random literary phrase

βœ…

proverb()

Returns a random Arabic proverb

βœ…

poem()

Returns a random line of poetry

βœ…

paragraph()

Returns a random paragraph

βœ…

word()

Returns a single random Arabic word

βœ…

select(category)

Generic text selector by category

βœ…

sample(category, max_length)

Returns multiple lines from category

βœ…

rand_sentence()

Generates a nonsense sentence

❌

rand_sentences(n)

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