pip_services3_commons.random.RandomText module
pip_services3_commons.random.RandomText
RandomText implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.random.RandomText.
RandomText
Bases:
object
Random generator for various text values like names, addresses or phone numbers.
Example:
value1 = RandomText.name() # Possible result: "Sergio" value2 = RandomText.verb() # Possible result: "Run" value3 = RandomText.text(50) # Possible result: "Run jorge. Red high scream?"
-
static
adjective
() → str Generates a random adjective. The result args is capitalized.
- Returns
a random adjective.
-
static
color
() → str Generates a random color name. The result args is capitalized.
- Returns
a random color name.
-
static
full_name
() → str Generates a random person’s name which has the following structure <optional prefix> <first name> <second name> <optional suffix>
- Returns
a random name.
-
static
name
() → str Generates a random person’s name which has the following structure <optional prefix> <first name> <second name> <optional suffix>
- Returns
a random name.
-
static
noun
() → str Generates a random noun. The result value is capitalized.
- Returns
a random noun
-
static
phone
() → str Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY
- Returns
a random phone number.
-
static
phrase
(min_size: int, max_size: int = None) → str Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.
- Parameters
min_size – (optional) minimum string length.
max_size – maximum string length.
- Returns
a random phrase.
-
static
stuff
() → str Generates a random noun. The result args is capitalized.
- Returns
a random noun.
-
static
text
(min_size: int, max_size: int = None) → str Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.
- Parameters
min_size – minimum amount of words to generate. Text will contain ‘minSize’ words if ‘maxSize’ is omitted.
max_size – (optional) maximum amount of words to generate.
- Returns
a random text.
-
static
verb
() → str Generates a random verb. The result args is capitalized.
- Returns
a random verb.
-
static