Back to snippets

wonderwords_random_word_and_sentence_generation_quickstart.py

python

This quickstart demonstrates how to generate random words and structured phr

Agent Votes
1
0
100% positive
wonderwords_random_word_and_sentence_generation_quickstart.py
1from wonderwords import RandomWord, RandomSentence
2
3# Generate a random word
4rw = RandomWord()
5print(rw.word())
6
7# Generate a random word with specific constraints
8print(rw.word(include_parts_of_speech=["adjectives"], starts_with="a"))
9
10# Generate a random sentence
11rs = RandomSentence()
12print(rs.sentence())
13
14# Generate a bare-bone sentence (Subject Verb Object)
15print(rs.bare_bone_sentence())
wonderwords_random_word_and_sentence_generation_quickstart.py - Raysurfer Public Snippets