Skip to main content

Hand-curated dataset of English names and nicknames.

Project description

PyPI version

Nicknames

A hand-curated CSV file containing English given names (first names) and their associated nicknames.

For more info on the source and format of the data, see https://github.com/carltonnorthern/nicknames. In case that is useful to you, there are also SQL and typescript bindings there.

Python API

The Python package is available on PyPI from

uv add nicknames

and then you can get to the csv data directly:

from nicknames import name_triplets

# name_triplets() returns a list of a NamedTuples:
print(name_triplets()[:3])
# [NameTriplet(name1='aaron', relationship='has_nickname', name2='erin'), NameTriplet(name1='aaron', relationship='has_nickname', name2='ron'), NameTriplet(name1='aaron', relationship='has_nickname', name2='ronnie')]

Or, we have an NickNamer class which provides several convenience methods:

from nicknames import NickNamer

nn = NickNamer()

# Get the nicknames for a given name as a set of strings
nicks = nn.nicknames_of("Alexander")
assert isinstance(nicks, set)
assert "al" in nicks
assert "alex" in nicks

# Note that the relationship isn't symmetric: al is a nickname for alexander,
# but alexander is not a nickname for al.
assert "alexander" not in nn.nicknames_of("al")

# Capitalization is ignored and leading and trailing whitespace is ignored
assert nn.nicknames_of("alexander") == nn.nicknames_of(" ALEXANDER ")

# Queries that aren't found return an empty set
assert nn.nicknames_of("not a name") == set()

# The other useful thing is to go the other way, nickname to canonical:
# It acts very similarly to nicknames_of.
can = nn.canonicals_of("al")
assert isinstance(can, set)
assert "alexander" in can
assert "alex" in can

assert "al" not in nn.canonicals_of("alexander")

# You can combine these to see if two names are interchangeable:
union = nn.nicknames_of("al") | nn.canonicals_of("al")
are_interchangeable = "alexander" in union

For more advanced usage, such as loading your own data, read the source code.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nicknames-1.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nicknames-1.0.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file nicknames-1.0.1.tar.gz.

File metadata

  • Download URL: nicknames-1.0.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nicknames-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0b599c1ebf6844c5a65659d46d024c46e9c2cf66b3046e119107e82a14598e6a
MD5 394f64894445f31bba6279f58a28588d
BLAKE2b-256 86bab555aee8afcf22fcd463886279d063c48eba71b99a55551cd2a7ca0e3577

See more details on using hashes here.

Provenance

The following attestation bundles were made for nicknames-1.0.1.tar.gz:

Publisher: release-python.yml on carltonnorthern/nicknames

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nicknames-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: nicknames-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nicknames-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30608a6a50086bb508e6d5f4fb618ef4f988d5604f73ec1ebcccbc92952f9de9
MD5 0b237e939530d1c9070f98018ad84511
BLAKE2b-256 2155f820209a0a0ab535246a901e53fdadb4fcf562b37712d4d7f45c56ae1dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for nicknames-1.0.1-py3-none-any.whl:

Publisher: release-python.yml on carltonnorthern/nicknames

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page