Skip to main content

Get the gender from first name.

Project description

This package uses the underlying data from the program “gender” by Jorg Michael (described here). Its use is pretty straightforward:

>>> import gender_guesser.detector as gender
>>> d = gender.Detector()
>>> d.get_gender(u"Bob")
u'male'
>>> d.get_gender(u"Sally")
u'female'
>>> d.get_gender(u"Pauley") # should be androgynous
u'andy'

The result will be one of andy (androgynous), male, female, mostly_male, or mostly_female. Any unknown names are considered andies. Moreover, you can set unknown value to whatever you want:

>>> d = gender.Detector(unknown_value=u"ferhat")
>>> d.get_gender(u"Pauley")
u'ferhat'

I18N is fully supported:

>>> d.get_gender(u"Álfrún")
u'female'

Additionally, you can give preference to specific countries:

>>> d.get_gender(u"Jamie")
u'mostly_female'
>>> d.get_gender(u"Jamie", u'great_britain')
u'mostly_male'

Additionally, you can create a detector that is not case sensitive (default is to be case sensitive):

>>> d = gender_guesser.detector.Detector(case_sensitive=False)
>>> d.get_gender(u"sally")
u'female'
>>> d.get_gender(u"Sally")
u'female'

Try to avoid creating many Detectors, as each creation means reading the data file.

Licenses

The generator code is distributed under the GPLv3. The data file nam_dict.txt is released under the GNU Free Documentation License.

Changelog

0.2.0 (2015-12-06)

  • Wire in tox to test in both Python 2 and Python 3.

  • Python 2 and 3 compatiblity.

  • Remove obsolete character mapper code.

For previous versions, see sexmachine.

Credits

This is a fork of the SexMachine package by Ferhat Elmas. It was created to be able to publish a Python 3 compatible version to PyPI and to be able add some more improvements without bugging the original author.

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

gender-guesser-0.2.0.tar.gz (336.8 kB view details)

Uploaded Source

Built Distribution

gender_guesser-0.2.0-py2.py3-none-any.whl (379.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gender-guesser-0.2.0.tar.gz.

File metadata

File hashes

Hashes for gender-guesser-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e55de155109199d6b5b87b755c0fa950a1b2a6a670cb28c1fe86f610a8956d55
MD5 c3cf14ba389d5a0a33844d9051d6b330
BLAKE2b-256 789a63063a52f7422fdb065915b08a973dbe89273fa0e99fe4e646cfd60d3daa

See more details on using hashes here.

File details

Details for the file gender_guesser-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for gender_guesser-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d7765c76c379ff938561f2e24a7047c997e86c630b8c6b6c0d280ce10d141ca1
MD5 9f0e3f96bcd36a7f444d2bd2e98614ed
BLAKE2b-256 92502a8a3f8dbe56571ee8f09db4b323c28d9760512647183b38745befad19c3

See more details on using hashes here.

Supported by

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