# evennia.contrib.utils.name_generator.namegen

Random Name Generator

Contribution by InspectorCaracal (2022)

A module for generating random names, both real-world and fantasy. Real-world names can be generated either as first (personal) names, family (last) names, or full names (first, optional middles, and last). The name data is from [Behind the Name](https://www.behindthename.com/) and used under the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0/).

Fantasy names are generated from basic phonetic rules, using CVC syllable syntax.

Both real-world and fantasy name generation can be extended to include additional information via your game’s settings.py

Available Methods:

> first_name - Selects a random a first (personal) name from the name lists. last_name - Selects a random last (family) name from the name lists. full_name - Generates a randomized full name, optionally including middle names, by selecting first/last names from the name lists. fantasy_name - Generates a completely new made-up name based on phonetic rules.

Method examples:

    >>> namegen.first_name(num=5)
    ['Genesis', 'Tali', 'Budur', 'Dominykas', 'Kamau']

    >>> namegen.full_name(parts=3, surname_first=True)
    'Ó Muircheartach Torunn Dyson'
    >>> namegen.full_name(gender='f')
    'Wikolia Ó Deasmhumhnaigh'

    >>> namegen.fantasy_name(num=3, style="fluid")
    ['Aewalisash', 'Ayi', 'Iaa']

Available Settings (define these in your settings.py)

> NAMEGEN_FIRST_NAMES - Option to add a new list of first (personal) names. NAMEGEN_LAST_NAMES - Option to add a new list of last (family) names. NAMEGEN_REPLACE_LISTS - Set to True if you want to use ONLY your name lists and not the ones that come with the contrib. NAMEGEN_FANTASY_RULES - Option to add new fantasy-name style rules.

> > Must be a dictionary that includes “syllable”, “consonants”, “vowels”, and “length” - see the example. “start” and “end” keys are optional.

Settings examples:

NAMEGEN_FIRST_NAMES = [

  > (“Evennia”, ‘mf’), (“Green Tea”, ‘f’),

  ]

NAMEGEN_LAST_NAMES = [ “Beeblebrox”, “Son of Odin” ]

NAMEGEN_FANTASY_RULES = {
  “example_style”: {

    > “syllable”: “(C)VC”, “consonants”: [ ‘z’,’z’,’ph’,’sh’,’r’,’n’ ], “start”: [‘m’], “end”: [‘x’,’n’], “vowels”: [ “e”,”e”,”e”,”a”,”i”,”i”,”u”,”o”, ], “length”: (2,4),

    }

  }

`evennia.contrib.utils.name_generator.namegen.``fantasy_name`(num=1, style='harsh', return_list=False)

  Generate made-up names in one of a number of “styles”.

  Keyword Arguments

    - num (int) –

    - style (string) –

    - return_list (bool) – which returns a string if there is only one value and a list if more.

`evennia.contrib.utils.name_generator.namegen.``first_name`(num=1, gender=None, return_list=False)

  Generate first names, also known as personal names.

  Keyword Arguments

    - num (int) –

    - gender (str) – all possible names. Set to “m” for masculine, “f” for feminine, “mf” for androgynous

    - return_list (bool) – which returns a string if there is only one value and a list if more.

`evennia.contrib.utils.name_generator.namegen.``last_name`(num=1, return_list=False)

  Generate family names, also known as surnames or last names.

  Keyword Arguments

    - num (int) –

    - return_list (bool) – which returns a string if there is only one value and a list if more.

`evennia.contrib.utils.name_generator.namegen.``full_name`(num=1, parts=2, gender=None, return_list=False, surname_first=False)

  Generate complete names with a personal name, family name, and optionally middle names.

  Keyword Arguments

    - num (int) –

    - parts (int) – first and last.

    - gender (str) – all possible names. Set to “m” for masculine, “f” for feminine, “mf” for androgynous

    - return_list (bool) – which returns a string if there is only one value and a list if more.

    - surname_first (bool) – placed at the beginning of the name instead of the end.