https://github.com/ferhatelmas/sexmachine
:lipstick: Get gender from first name in python
https://github.com/ferhatelmas/sexmachine
Last synced: about 1 month ago
JSON representation
:lipstick: Get gender from first name in python
- Host: GitHub
- URL: https://github.com/ferhatelmas/sexmachine
- Owner: ferhatelmas
- License: gpl-3.0
- Created: 2013-04-17T05:42:01.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T18:30:17.000Z (about 7 years ago)
- Last Synced: 2025-04-09T15:04:43.946Z (about 1 month ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/SexMachine/
- Size: 550 KB
- Stars: 164
- Watchers: 20
- Forks: 67
- Open Issues: 8
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.txt
- License: LICENSE
Awesome Lists containing this project
README
===========
Sex Machine
===========PyPI status:
.. image:: https://pypip.in/v/SexMachine/badge.png
:target: https://pypi.python.org/pypi/SexMachine/.. image:: https://pypip.in/d/SexMachine/badge.png
:target: https://pypi.python.org/pypi/SexMachine/This package uses the underlying data from the program "gender" by Jorg Michael (described `here `_). Its use is pretty straightforward::
>>> import sexmachine.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 = sexmachine.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.