wonderwords.random_sentence¶
Generate structured sentences in which every word is random.
-
class
wonderwords.random_sentence.
RandomSentence
(nouns: Optional[List[str]] = None, verbs: Optional[List[str]] = None, adjectives: Optional[List[str]] = None)¶ Bases:
object
The RandomSentence provides an easy interface to generate structured sentences where each word is randomly generated.
Example:
>>> s = RandomSentence(nouns=["car", "cat", "mouse"], verbs=["eat"]) >>> s2 = RandomSentence()
Parameters: - nouns (list, optional) – a list of nouns that will be used to generate random nouns. Defaults to None.
- verbs (list, optional) – a list of verbs that will be used to generate random verbs. Defaults to None.
- adjectives (list, optional) – a list of adjectives that will be used to generate random adjectives. Defaults to None.
-
bare_bone_sentence
()¶ Generate a bare-bone sentence in the form of
The [subject (noun)] [predicate (verb)].
. For example:The cat runs.
.Example:
>>> s.bare_bone_sentence()
Returns: string in the form of a bare bone sentence where each word is randomly generated Return type: str
-
bare_bone_with_adjective
()¶ Generate a bare-bone sentence with an adjective in the form of:
The [(adjective)] [subject (noun)] [predicate (verb)].
. For example:The skinny cat reads.
Example:
>>> s.bare_bone_with_adjective()
Returns: a string in the form of a bare-bone sentence with an adjective where each word is randomly generated Return type: str
-
sentence
()¶ Generate a simple sentence with an adjective in the form of:
The [(adjective)] [subject (noun)] [predicate (verb)] [direct object (noun)].
. For example:The green orange likes food.
Example:
>>> s.sentence()
Returns: a string in the form of a simple sentence with an adjective where each word is randomly generated Return type: str
-
simple_sentence
()¶ Generate a simple sentence in the form of
The [subject (noun)] [predicate (verb)] [direct object (noun)].
. For example:The cake plays golf
.Example:
>>> s.simple_sentence()
Returns: a string in the form of a simple sentence where each word is randomly generated Return type: str