Skip to main content
Genderizer
======================

Genderizer is a language independent module which tries to detect gender by looking given first names and/or analyzing sample texts.

##Installation
You can install this package using the following ```pip``` command:

```sh
$ sudo pip install genderizer
```


##Examples

```python
from genderizer.genderizer import Genderizer

print Genderizer.detect(firstName = 'John')
# >>> male

print Genderizer.detect(firstName = 'Marry')
# >>> female

print Genderizer.detect(firstName = 'mustafa')
# >>> male

print Genderizer.detect(firstName = 'fatma')
# >>> female

print Genderizer.detect(firstName = 'fikret')
# >>> None

print Genderizer.detect(firstName = 'fikret', text='galatasary maçı kaçmaz')
# >>> male

print Genderizer.detect(firstName = 'fikret', text='annemlerle yemek yedik')
# >>> female

print Genderizer.detect(text='askerlik yoklamasını kaçırdım mk')
# >>> male

print Genderizer.detect(text='bana çiçek alan erkek için canım feda')
# >>> female

print Genderizer.detect(firstName='fatma', text='askerlik yoklamasını kaçırdım mk')
# >>> female

print Genderizer.detect(text='futbol sevgi')
# >>> None

print Genderizer.detect(text='lan bi siktir git')
# >>> male

```
***Note***: You may claim that women can say ```lan bi siktir git```, of course. But the probability of being female is less than the probability of being male according the trained data of the classifier.

By the way, in Turkish saying 'lan bi siktir git' makes you quite rude.


## How It Works
Genderizer is a module which tries to detect gender by looking given first names and/or analyzing sample text of a person.

If a first name is definitely used for only one gender, the system will accept this gender and will not make any further analysis. For example, while 'Mustafa', 'Osman', 'Hasan' is used in Turkish only for male; 'Fatma', 'Ceyda', 'Elif' only for female.

When looking at first names does not infer any gender for sure, the system will make text analysis if it is given. For example; 'Ekim', 'Meric', or 'Tümay' is used for both male and female.

The text analysis is the classification of sample texts. It simply try to compute the probability of being male or female mining the sample text. In this system Naive Bayesian Classification is adopted and [naiveBayesClassifier][1] is used.

## How To Improve It
TODO: write a step by step guide

##Preparing Language Dependent Training Sets
TODO: give a few examples

## Customization and Optimization
TODO: Tell what options are there and when to choose
```python
from genderizer.memcachedNamesCollection import MemcachedNamesCollection
from genderizer.mongoNamesCollection import MongoNamesCollection

MongoNamesCollection.mongodbURL = 'mongodb://192.168.1.170'
Genderizer.init(
lang='tr',
namesCollection=MongoNamesCollection
)

#For memcached, you need to setup a memcached server.
MemcachedNamesCollection.memcacheHost = '127.0.0.1:11211'
Genderizer.init(
lang='tr',
namesCollection=MemcachedNamesCollection
)

Genderizer.init(
lang='tr',
namesCollection=NamesCollection,
classifier=Classifier(CachedModel.get('tr'), tokenizer)
)

print Genderizer.detect(firstName = 'fikret', text='annem')

```

## TODO
* inline docs
* unit-tests

## AUTHORS
* Mustafa Atik [@muatik][2]
* Nejdet Yucesoy @nejdetckenobi


[1]: https://github.com/muatik/naive-bayes-classifier
[2]: https://twitter.com/muatik2

Metadata

Release files for genderizer 0.1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for genderizer 0.1.2.3
File Size Uploaded Provenance
genderizer-0.1.2.3.tar.gz 9.4 MB Without provenance Details

Release files / genderizer-0.1.2.3.tar.gz

Download URL genderizer-0.1.2.3.tar.gz
Size 9.4 MB
Tags Source
SHA-256 checksum
How to use checksums
d003c4c0742988d159e17547c554d6c581d5fdf57d34df50bd1985a50bbe9f48
BLAKE2b-256 checksum
How to use checksums
6425bd9c6b986ead941ed23a81f300506b73d07fc71e479bbbf70d865725f387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for genderizer 0.1.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2.3 This release

1 release file No provenance

0.1.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page