Skip to content

Random Sentence

Maxim R edited this page Mar 22, 2020 · 8 revisions

The random_sentence Sub-module

The random_sentence sub-module is the newest module and so far only has one function in the random_sentence class. This sub-module deals with randomly generating sentences. We are working toward making them more advanced and grammatically correct rather than using a sentence template. This page contains information on how to import this sub-module as well as how to use the functions in it.


Table of contents


Import

Before use, make sure to import this sub-module. Do so in the following way:

from wonderwords import random_sentence

Another way you can do this is:

import wonderwords.random_sentence

bare_bone_sentence()

The bare_bone_sentence function randomly generates a sentence composed of one article, a noun and a verb such as: The dog pouts.

Syntax

bare_bone_sentence()

Parameters

None

Returns

A bare bone sentence with a noun, verb and article.

Example

from wonderwords import random_sentence
english_sentence = random_sentence.random_sentence()

# Set variable random_bare_bone_sentence to a randomly generated bare bone sentence
random_bare_bone_sentence = english_sentence.bare_bone_sentence()

simple_sentence()

This function randomly generates a bare-bone sentence with a direct object such as: The cow interests everybody.

Syntax

simple_sentence()

Parameters

None

Returns

Returns a simple sentence

Example

from wonderwords import random_sentence
english_sentence = random_sentence.random_sentence()

# Set variable random_simple_sentence to a randomly generated simple sentence
random_simple_sentence = english_sentence.simple_sentence()

bare_bone_with_adjective()

This function generates a bare-bone sentence with an adjective that describes the noun, such as: The red dog plays.

Syntax

bare_bone_with_adjective()

Parameters

None

Returns

A bare bone sentence with a noun, verb and adjective.

Example

from wonderwords import random_sentence
english_sentence = random_sentence.random_sentence()

# Set variable random_bare_bone_sentence_with_adjective to a randomly generated bare bone sentence with an adjective
random_bare_bone_sentence_with_adjective = english_sentence.bare_bone_with_adjective()

sentence()

Sentence() returns a sentence with a noun, verb, adjective and direct object. For example: The interesting man eats thoughts.

Syntax

sentence()

Parameters

None

Returns

Returns a sentence with noun, verb, adjective and direct object

Example

from wonderwords import random_sentence
english_sentence = random_sentence.random_sentence()

# Set variable my_random_sentence to a randomly generated sentence
my_random_sentence = english_sentence.sentence()

⚠️ This documentation will no longer be updated, as Wonderwords version 2 is now out. You can find the new documentation at https://wonderwords.readthedocs.io

Clone this wiki locally