GitXplorerGitXplorer
f

sexmachine

public
164 stars
66 forks
8 issues

Commits

List of commits on branch master.
Unverified
85d33bb47ccc017676e69788750f116e391f52db

added readme badges

fferhatelmas committed 11 years ago
Unverified
50a75143dc9d3eccacf5f1fe8cead5fbe8261ccb

silly me, forgot data file

fferhatelmas committed 11 years ago
Unverified
ce97af903694ae5ebed53c716d4af9e69614ddbf

ord bug, mapping, unsupported chars, readme typos

fferhatelmas committed 11 years ago
Unverified
f6e31f3daef8f85ebc67583f62771d964d122d77

first cut

fferhatelmas committed 11 years ago

README

The README file for this repository.

=========== 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 <http://www.autohotkey.com/community/viewtopic.php?t=22000>_). 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.