Skip to main content

Marko-Namo

PyPi Version Python Versions License

Code Hygiene codecov black codestyle

Documentation Status


Simple tool to generate random project or business names using a basic Markov Chain approach.

Installation

Install marko-namo from the Python Package Index:

$ pip install marko-namo

Requirements

  • Python 3.8+

How It Words

The generator starts by creating a frequency table based on the training words supplied and the n-grams listed. Eg if our training word is hello and our n-grams are 1 and 2, we'd get a frequency table of:

{
    "h": ["e", "el"],
    "he": ["l", "ll"],
    "e": ["l", "ll"],
    "el": ["l", "lo"],
    "l": ["l", "lo", "o", null],
    "ll": ["o", null],
    "lo": [null, null],
    "o": [null, null]
}

It then randomly selects an n-gram from the frequency table as the first letter, randomly selects a following letter and repeats until the word either ends (selects a None) or reaches the maximum word length.

Eg if the first selected letter was e we might go:

  • e -> l -> lo -> None
  • Which gives ello

How To Run

You can either create a config file and pass that in or specifiy your parameters in code. To get started, you can utilse the config_sample.yml.

from marko_namo import MarkoNamo

random_name_generator = MarkoNamo("config_sample.yml")
created_names, available_domains = random_name_generator.create_random_names()

If you'd rather not use a config file then you can run:

from marko_namo import MarkoNamo

random_name_generator = MarkoNamo(
    name_length = 5,
    number_of_names = 10,
    training_words = ["hello", "pineapple", "planet"]
)
created_names, available_domains = random_name_generator.create_random_names()

Parameters

Parameter Type Description
number_of_names Integer Number of names to attempt to create
maximum_name_length Integer Maximum name length. Note names can be up to length + largest n-gram in length
n_grams List of integers The word segment lengths to consider for learning and generating new words.
extensions List of strings Domain extensions to check for such as .com, .ai, etc
training_words List of strings Words to learn from and used to generate new, random, words. There's no limit to the number of words to learn from but too many will slow the program down significantly.

Domain Name Lookup

If you'd like to check if the domain name (eg www.randomname.com) is available for the generated names then you'll also need a GoDaddy API key. This can be generated at the following: https://developer.godaddy.com/keys

You'll need to provide:

  • API Key
  • API Secret
  • Whether you'd like to use their OTE (test) or PROD (production) environment

Building the Project

This package uses poetry and nox for package management and building.

If nox is not already installed, install it:

$ pip install nox
$ pip install nox_poetry

Run everything including tests and documentation building

$ nox

# Or to run a specific stage:
$ nox -s <stage name>, eg
$ nox -s tests

Testing

Nox also handles the tests but you'll require OTE & PROD keys to run the GoDaddy tests.

  1. Register with GoDaddy and generate OTE & PROD keys
  2. Set them as environment variables:
# GoDaddy OTE
GODADDY_OTE_KEY=<OTE Key>
GODADDY_OTE_SECRET=<OTE Secret>
GODADDY_OTE_ENV=OTE

# GoDaddy Prod
GODADDY_PROD_KEY=<Prod Key>
GODADDY_PROD_SECRET=<Prod Secret>
GODADDY_PROD_ENV=PROD
  1. Run the tests:
$ nox -s tests

Issues

If you encounter any problems, please file an issue along with a detailed description.

Release files for marko-namo 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marko-namo 0.3.0
File Size Uploaded
marko-namo-0.3.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for marko-namo 0.3.0
File Interpreter ABI Platform
marko_namo-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / marko-namo-0.3.0.tar.gz

Download URL marko-namo-0.3.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a701f8c13dea908996b67c24ede503ab69cb41c5af370c52f182ba2f669aa214
BLAKE2b-256 checksum
How to use checksums
81abcfd01f807e22435782b224eb84543aa45d8ec123f57fdad256da5227f34a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.10 Darwin/21.6.0

Release files / marko_namo-0.3.0-py3-none-any.whl

Download URL marko_namo-0.3.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e921d8099e439b6bed24dbce482eb2b8af71e348e1ea0b300820755964632af4
BLAKE2b-256 checksum
How to use checksums
09c2ee722de34e19c849ea374a48142b0338d96cb73fbedcfe333a9682b967ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.10 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page