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 genderator
You may also use Git to clone the repository from Github and install it manually:
git clone https://github.com/davidmogar/genderator.git cd genderator python setup.py install
Python 3.3 & 3.4 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.
Release files for genderator 0.2.7.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| genderator-0.2.7.9.zip | 891.6 kB | Details |
Release files / genderator-0.2.7.9.zip
| Download URL | genderator-0.2.7.9.zip |
|---|---|
| Size | 891.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa8fe9e1527c84c20741aabf85697ffb8c811cdc0c41aefdc106f6f5ffcbb708
|
|
BLAKE2b-256 checksum How to use checksums |
f5005024c829901e4b5f4070abeff0e909a16a47ab9295061cd56d882a6f50f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |