Skip to main content

A simple python package to detect gender by Persian first name. (With more than 19K names).

Project description

Persian Gender Detection

A simple python package to detect gender by Persian first name. (With more than 19K names)

for this package i use this repo if you are use NPM that's great choice.

User guide

Installation

Install with PIP:

$ pip install persian-gender-detection

get_gender

this function works for finding gender and returning gender. if find the gender return it, otherwise return UNKNOWN

Example

from persian_gender_detection import get_gender

# Detect gender
get_gender('  عــــلی  ')             # MALE
get_gender('نرگـــ😉ــس')             # FEMALE
get_gender('حســ😎ــن')               # MALE
get_gender('۱۲۳۹۹۳محمدعلی123')        # MALE
get_gender('۱۲۳مهناز۱۲۳')             # FEMALE
get_gender('فاطمه زهرا')              # UNKNOWN
get_gender("جانان")                   # UNKNOWN

get_gender_nearest

sometimes is difficult to find the gender from names, this problem can have many reasons for example 2 parts names or mistakes in writing. This function helps to solve this problem to some extent.

Example

from persian_gender_detection import get_gender_nearest

get_gender_nearest('فاطمه زهرا')      # (FEMALE, 'فاطمه')
get_gender_nearest('محمدنیسنممدیتیس') # ('MALE', 'محمد')
get_gender_nearest("جانان")           # ("FEMALE", "جانا")

Changelog

1.4.0
first, thanks to amirsoroush for the changes and improvement code, in this PR you can see all of the changes. But in summary, the following has been done:

  • improve and simplify code and formatting, remove unused packages.
  • Adding a new function for finding the nearest name and removing the find_nearst_name flag for better output.

1.2.1

  • Fixed issues in two-part names and added find_nearst_name flag to find and return the nearest name.

1.1.0

  • Increasing the dataset of names from 6k to 19k
  • convert names dataset from JSON to Python dictionary
  • If a name does not exist in the dataset, it finds the gender in two-part names using the first part.

1.0.5

  • First version with 6k name dataset

Issues

Feel free to submit issues and enhancement requests.

Contributing

Please feel free to contribute names database with your kindly pull requests.

License

Licensed under MIT License

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

persian-gender-detection-1.4.0.tar.gz (140.9 kB view details)

Uploaded Source

Built Distribution

persian_gender_detection-1.4.0-py3-none-any.whl (275.9 kB view details)

Uploaded Python 3

File details

Details for the file persian-gender-detection-1.4.0.tar.gz.

File metadata

File hashes

Hashes for persian-gender-detection-1.4.0.tar.gz
Algorithm Hash digest
SHA256 3487c01630816924ab412f85cf80017b7c58ba20b8e3a8fceb674568d8918cbf
MD5 5251183dd49c613a0039f4983b04bf77
BLAKE2b-256 c9175c9b1ec7486046871c8a2b9b397acc5fd6c88d086169e3c166831c15f6eb

See more details on using hashes here.

File details

Details for the file persian_gender_detection-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for persian_gender_detection-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91705d315e36c5f413db3d19744ca022c9b1af19b08d152bb5b001a9cf3c1776
MD5 6ccac3dec3a650ef6c965d29a47797c7
BLAKE2b-256 5cfc0973af3c85547c5c9ad7c69530dbe79d8c0bf9c50ebcb318640a344a802b

See more details on using hashes here.

Supported by

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