Skip to main content

Python library to guess gender given a spanish full name for Python 3.11+

Project description

https://img.shields.io/travis/davidmogar/genderator.svg https://img.shields.io/coveralls/davidmogar/genderator.svg https://img.shields.io/pypi/v/genderator.svg https://img.shields.io/badge/license-MIT-blue.svg https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg

Genderator is a Python library to process Spanish names (from Spain) to guess their gender.

For this to work, the libray uses the next datasets from Instituto Nacional de Estadística:

  • name_surname_ratio: List of words that could be both, a name or a surname, and shows the probability to be a surname.

  • names_ine: List of registered names on Spain, with the probability for each one to be a male or a female name.

  • surnames_ine: List of registeres surnames on Spain.

Installation

The easiest way to install the latest version is by using pip to pull it from PyPI:

pip install genderator311

You may also use Git to clone the repository from Github and install it manually:

git clone https://github.com/xumixprto/genderator311.git
cd genderator
python setup.py install

Python 3.11+ are supported.

Usage

The next code shows a sample usage of this library:

import genderator

guesser = genderator.Parser()
answer = guesser.guess_gender('David Moreno García')
if answer:
    print(answer)
else:
    print('Name doesn\'t match')

Output

OrderedDict([
    ('names', ['david']),
    ('surnames', ['moreno', 'garcia']),
    ('real_name', 'david'),
    ('gender', 'Male'),
    ('confidence', 1.0)
])

Options

Genderator’s parser can receive some arguments to control its behaviour. Those arguments are:

  • force_combinations=Boolean: Force combinations during classification.

  • force_split=Boolean: Force name split if no surnames are detected.

  • normalize=Boolean: Enable or disable normalization.

  • normalizer_options=Dictionary: Normalizer options to be applied.

Normalizer options are a dictionary to control what normalization rules are applied to each name. Possible options are:

  • hyphens: Boolean option to enable or disable hyphens removal.

  • symbols: Boolean option to enable or disable symbols removal.

  • whitespaces: Boolean option to enable or disable extra whitespaces removal.

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

genderator311-0.2.8.1.tar.gz (882.6 kB view details)

Uploaded Source

Built Distribution

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

genderator311-0.2.8.1-py3-none-any.whl (879.3 kB view details)

Uploaded Python 3

File details

Details for the file genderator311-0.2.8.1.tar.gz.

File metadata

  • Download URL: genderator311-0.2.8.1.tar.gz
  • Upload date:
  • Size: 882.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for genderator311-0.2.8.1.tar.gz
Algorithm Hash digest
SHA256 11eea60fed0ac0b8af35af2eaac35636356791aacd665ce92c79c9f211d99ff6
MD5 819056f91f5f0284067c3b72bb20b35b
BLAKE2b-256 670702989a5928f9a36345947c3bb832c421ffb2be0fed7c35b5b5b11e24bc31

See more details on using hashes here.

File details

Details for the file genderator311-0.2.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for genderator311-0.2.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f585fe1c9d764f09b61f94b502ff28e29894f99c6dccc47973115e551d3dfed5
MD5 9cd5cb02d7eeeff1eaa8d98774e6d520
BLAKE2b-256 b3cbdb7943c7fdbe04966e9f457d935ed6fa4f6d6d1cc8347a5129c8decf2c07

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