Metadata-Version: 2.1
Name: genderperformr
Version: 1.0
Summary: GenderPerformr
Home-page: https://github.com/zijwang/genderperformr
Author: Zijian Wang and David Jurgens
Author-email: zijwang@stanford.edu
License: UNKNOWN
Platform: UNKNOWN
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: torch (>=0.4.1)
Requires-Dist: numpy
Requires-Dist: unidecode

# GenderPerformr

## Intro
GenderPerformr is the model release from the paper `It’s going to be okay: Measuring Access to Support in Online Communities` by Zijian Wang and David Jurgens (in proceedings of EMNLP 2018).

It is the current state-of-the-art method that predicts gender from usernames based on a LSTM model built in PyTorch (as of Sept. 2018). 
## Install 

### Use pip
If `pip` is installed, genderperformr could be installed directly from it:

	pip install genderperformr
### From raw
`git clone` the project and do:

	python setup.py install

### Dependencies
	python>=3.6.0
	torch>=0.4.1
	numpy
	unidecode


## Usage and Example

### `predict`
`predict` is the core method of this package, 
which takes a single username of a list of usernames, and returns a tuple of raw probabilities in `[0,1]` (0 - Male, 1 - Female), and labels (M - Male, N - Neutral, F - Female, empty string - others). 

### Simplest usage

You may directly import `genderperformr` and use the default predict method, e.g.:

    >>> import genderperformr
    >>> genderperformr.predict("BackRowJoe123")
    (0.08830917, 'M')

### Construct from class
Alternatively, you may also construct the object from class, where you could customize the model path and device:

	>>> from genderperformr import GenderPerformr
	>>> gp = GenderPerformr()

	# Predict a single username
	>>> gp.predict("Tom")
	(0.059030112, 'M')

	# Predict a list of names
	>>> probs, labels = gp.predict(["BarryCA67", "PizzaMagic", "KatieZ22"])
    >>> f"Raw probabilities are {probs}"
    Raw probabilities are [0.05770278 0.45214835 0.96221727]
    >>> f"Labels are {labels}"
    Labels are ['M', 'N', 'F']


More detail on how to construct the object is available in docstrings.

### Model using new data partition 
If you want to use the model described in Supplemental Material using the new data partition, you may construct the object via

    >>> gp = GenderPerformr(is_new_model=True)

All other usages remain the same.


## Citation
    @inproceedings{wang2018its,
           title={It's going to be okay: Measuring Access to Support in Online Communities},
           author={Wang, Zijian and Jurgens, David},
           booktitle={Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP)},
           year={2018}
    }

## Contact
Zijian Wang (zij<last_name>@stanford.edu)

David Jurgens (<last_name>@umich.edu)


