Text-based gender prediction for Twitter.
A packaged version, adapted to Python 3, of the TwitterGenderPredictor code by JT Wolohan, which itself is a Python 2 implementation of Sap et al.’s gender prediction algorithm for Twitter. SPEKS stands for Sap, Park, Eichstaedt, Kern and Stilwell, the first five writers of the paper describing the algorithm implemented here.
>>> from speks import predict_gender_by_tweets >>> gender = predict_gender_by_tweets(" ".join(["Please Do.", "Join me in praying!"]))
- Supports Python 3.
- Fully tested.
pip install speks
This is a Python 3, packaged version of the TwitterGenderPredictor code by JT Wolohan, which itself is a Python 2 implementation of Sap et al.’s gender prediction algorithm for Twitter. The algorithm should be 90% accurate given a large sample of users and a reasonable amount of data for each user.
You can have the package predict the gender of a Twitter user by providing the predict_gender_by_tweets function with a string containing tweets contents.
>>> from speks import predict_gender_by_tweets >>> gender = predict_gender_by_tweets(" ".join(["No touchy", "Trial by fire"]))
Most of the code was released by JT Wolohan under the MPL 2.0 license, and thus I’m releasing my additions under the same license. However, the tokenization code - although slightly adapted - was originally written by Christopher Potts and released under the CC BY-NC-SA 3.0 license, and thus remains released under this license.
Current package maintainer and author is Shay Palachy (firstname.lastname@example.org); You are more than welcome to approach him for help. Contributions are very welcomed.
git clone email@example.com:shaypal5/speks.git
Install in development mode, including test dependencies:
cd speks pip install -e '.[test]'
To run the tests use:
cd speks pytest
The project is documented using the numpy docstring conventions, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings. When documenting code you add to this project, follow these conventions.
Additionally, if you update this README.rst file, use python setup.py checkdocs to validate it compiles.
Original paper reference: Sap, M., Park, G., Eichstaedt, J., Kern, M., Stillwell, D., Kosinski, M., … & Schwartz, H. A. (2014). Developing age and gender predictive lexica over social media. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) (pp. 1146-1151).
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size speks-0.0.1-py3-none-any.whl (97.6 kB)||File type Wheel||Python version py3||Upload date||Hashes View|