GithubHelp home page GithubHelp logo

steelpangolin / genderize Goto Github PK

View Code? Open in Web Editor NEW
72.0 5.0 15.0 43 KB

Python client for the Genderize.io web service.

Home Page: https://bat-country.us/#genderize

License: MIT License

Python 100.00%
gender-classification gender-from-name python api-client

genderize's Introduction

Genderize

Client for the Genderize.io web service.

https://img.shields.io/github/license/steelpangolin/genderize.svg?style=flat https://img.shields.io/pypi/v/Genderize.svg?style=flat https://img.shields.io/travis/SteelPangolin/genderize.svg?style=flat https://img.shields.io/codecov/c/github/SteelPangolin/genderize.svg?style=flat https://readthedocs.org/projects/genderize/badge/?style=flat

Basic usage

Import the Genderize class and call its get method with a list of names.

from genderize import Genderize
print(Genderize().get(['James', 'Eva', 'Thunderhorse']))
[{u'count': 1037, u'gender': u'male', u'name': u'James', u'probability': 0.99},
 {u'count': 234, u'gender': u'female', u'name': u'Eva', u'probability': 1.0},
 {u'gender': None, u'name': u'Thunderhorse'}]

Shell usage

If run as a script, takes a list of names on stdin, and prints them with their genders.

echo "James\nEva\nThunderhorse" | python -m genderize
James: male
Eva: female
Thunderhorse: None

Advanced usage

Create a Genderize instance with a custom user agent, an API key, and a shorter timeout than the default 30 seconds. Note that you'll need to use your own API key or this example won't work.

from genderize import Genderize
genderize = Genderize(
    user_agent='GenderizeDocs/0.0',
    api_key='example_api_key',
    timeout=5.0)
print(genderize.get(['James', 'Eva', 'Thunderhorse']))
[{u'count': 1037, u'gender': u'male', u'name': u'James', u'probability': 0.99},
 {u'count': 234, u'gender': u'female', u'name': u'Eva', u'probability': 1.0},
 {u'gender': None, u'name': u'Thunderhorse'}]

Maintenance

Setup for local development:

virtualenv --prompt '(genderize) ' venv -p python3
pip install -r requirements.txt
pip install -r requirements-dev.txt

Release checklist:

  1. Generate a new version number: major.minor.micro. It should be compatible with both PEP 440 and SemVer 2.0.0.
  2. Update __version__ in genderize/__init__.py. This is read by setup.py and doesn't need to be changed there.
  3. Add a changelog entry and date for the new version in CHANGES.rst.
  4. Commit the changes. This may be done as part of another change.
  5. Tag the commit with git tag major.minor.micro.
  6. Push the tag to GitHub with git push origin major.minor.micro.
  7. Travis will create a new PyPI release from the tag.

genderize's People

Contributors

granteagon avatar oychang avatar steelpangolin avatar vionemc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

genderize's Issues

using genderiz with big datasets

I am trying to use the genderize library to find the gender of a database of 7 thousands name, however, the function only returns the gender of the 10 first names in the dataset. Here is my code:
from genderize import Genderize
import csv
with open('mydata.csv', 'rb') as f:
reader = csv.reader(f)
your_list = list(reader)
print(Genderize().get(your_list))

Process stuck on windows

    logger.info("Start the genderize api")
    gen = (Genderize().get(names=[name_lowercase]))
    logger.info("end the genderize api")

The first line is set but we don't reach the second one, ctrl+c don't even close the process!
Is it that something is stuck ?

Give an option to not only return the data, but also the header

There are important informations regarding rate limit in the response header stated here.

X-Rate-Limit-Limit: 100000 // The amount of names in the current subscription period
X-Rate-Limit-Remaining: 1398 // The number of names left in the current subscription period
X-Rate-Reset: 13829 // Seconds remaining until a new subscription period starts

I am quite new in Github, I want to contribute here, but how to.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.