Skip to main content

From names in multiple languages to genders.

Project description

Name2Gender

From names in multiple languages to gender.

Installation

pip install -U name2gender

or

uv add -U name2gender
pip install git+https://github.com/vortezwohl/Name2Gender.git

Quick Start

  1. Import SDKs

    from name2gender import Name2Gender, Gender
    
  2. Gender recognition based on names

    n2g = Name2Gender()
    names = ['吴子豪', '吴彦祖', '梅艳芳', '张曼玉',
             'Donald Trump', 'Ivanka Trump',
             'Justin Bieber', 'The Weeknd',
             'Luigi Nicholas Mangione',
             'Elizabeth II', 'Henry VIII']
    for name in names:
        _gender, _prob = n2g(name, return_probability=True)
        print(name, 'is', _gender, 'with a probability of', f'{_prob * 100:.2f}%')
    

    stdout:

    吴子豪 is Gender.Male with a probability of 99.71%
    吴彦祖 is Gender.Male with a probability of 100.00%
    梅艳芳 is Gender.Female with a probability of 99.99%
    张曼玉 is Gender.Female with a probability of 99.92%
    Donald Trump is Gender.Male with a probability of 99.90%
    Ivanka Trump is Gender.Female with a probability of 99.66%
    Justin Bieber is Gender.Male with a probability of 100.00%
    The Weeknd is Gender.Male with a probability of 97.66%
    Luigi Nicholas Mangione is Gender.Male with a probability of 99.27%
    Elizabeth II is Gender.Female with a probability of 99.71%
    Henry VIII is Gender.Male with a probability of 99.90%
    

Use Name2Gender with CLI

  1. Install model

    n2g install name2gender-small
    

    stdout:

    Successfully installed model "name2gender-small".
    
  2. Predict genders

    n2g predict LadyGaga
    

    stdout:

    "LadyGaga" is FEMALE with an probability of 99.64%.
    
  3. Uninstall model

    n2g uninstall name2gender-small
    

    stdout:

    Model "name2gender-small" is uninstalled.
    

Project details


Download files

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

Source Distribution

name2gender-0.0.4a0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

name2gender-0.0.4a0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file name2gender-0.0.4a0.tar.gz.

File metadata

  • Download URL: name2gender-0.0.4a0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for name2gender-0.0.4a0.tar.gz
Algorithm Hash digest
SHA256 eabc7400f6a9dacd3ccb13afb42073a6307a959d0be1f74b2b5331cac4617a9d
MD5 d9c74cf330ba8c990e9e3950f6e0f378
BLAKE2b-256 51450faa4d891f2bde7813373312914039c836374e2039763436ea629f9a395a

See more details on using hashes here.

File details

Details for the file name2gender-0.0.4a0-py3-none-any.whl.

File metadata

File hashes

Hashes for name2gender-0.0.4a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cb3eea6dddfcbbb0c4a5787795c8dc9e7a61053b4756f87917b993f491b26eb
MD5 a929615c14f61685fb03d63857ba0f8b
BLAKE2b-256 13534b40bcc19c2bb5d0e102ae532e8fb128d66c26faa0e917653cf0411813dd

See more details on using hashes here.

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