Wonderwords

3.0.1 · active · verified Sun Apr 12

Wonderwords is a Python library for generating random English words and structured sentences. It also includes a command-line interface. Currently at version 3.0.1, it maintains an active development and release cadence, with significant updates between major versions.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize `RandomWord` and `RandomSentence` objects to generate individual words, filtered words, lists of words, and simple sentences.

from wonderwords import RandomWord, RandomSentence

rw = RandomWord()

# Generate a random word
word = rw.word()
print(f"Random word: {word}")

# Generate a random word that starts with 'a' and is an adjective
adj_word = rw.word(starts_with="a", include_categories=["adjective"])
print(f"Adjective starting with 'a': {adj_word}")

# Generate a list of 5 words that are nouns
noun_list = rw.words_list(amount=5, include_categories=["noun"])
print(f"5 random nouns: {noun_list}")

rs = RandomSentence()

# Generate a simple sentence
sentence = rs.simple_sentence()
print(f"Simple sentence: {sentence}")

view raw JSON →