gender_analysis.gender package¶
common module¶
gender module¶
-
class
gender_analysis.gender.gender.Gender(label, pronoun_series, names=None)¶ Bases:
objectDefines a gender that will be operated on in analysis functions
-
__eq__(other)¶ Performs a check to see whether two Gender objects are equivalent. This is true if and only if the Gender identifiers, pronoun series, and names are identical.
Note that this comparison works: >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> fem_pronouns = PronounSeries(‘Fem’, {‘she’, ‘her’, ‘hers’}, subj=’she’, obj=’her’) >>> female = Gender(‘Female’, fem_pronouns) >>> another_female = Gender(‘Female’, fem_pronouns) >>> female == another_female True
But this one does not: >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> they_series = PronounSeries(‘They’, {‘they’, ‘them’, ‘theirs’}, subj=’they’, obj=’them’) >>> xe_series = PronounSeries(‘Xe’, {‘xe’, ‘xer’, ‘xem’}, subj=’xe’, obj=’xem’) >>> androgynous_1 = Gender(‘NB’, they_series) >>> androgynous_2 = Gender(‘NB’, xe_series) >>> androgynous_1 == androgynous_2 False
Parameters: other – The other Gender object to compare Returns: True if the Gender`s are the same, `False otherwise
-
__init__(label, pronoun_series, names=None)¶ Initializes a Gender object that can be used for comparing and contrasting in the analysis functions.
The gender accepts one or more PronounSeries that will be used to identify the gender.
>>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> he_series = PronounSeries('Masc', {'he', 'him', 'his'}, subj='he', obj='him') >>> masc_names = ['Andrew', 'Richard', 'Robert'] >>> male = Gender('Male', he_series, names=masc_names) >>> 'Richard' in male.names True >>> 'robert' in male.names False >>> 'his' in male.pronouns True
Parameters: - label – String name of the gender
- pronoun_series – PronounSeries or collection of PronounSeries that the gender uses
- names – A collection of names (as strings) that will be associated with the gender. Note that the provided names are case-sensitive.
-
identifiers¶ Returns: Set of all words (i.e. pronouns and names) that are used to identify the gender >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> fem_pronouns = PronounSeries('Fem', {'she', 'her', 'hers'}, subj='she', obj='her') >>> fem_names = {'Sarah', 'Marigold', 'Annabeth'} >>> female = Gender('Female', fem_pronouns, fem_names) >>> female.identifiers == {'she', 'her', 'hers', 'Sarah', 'Marigold', 'Annabeth'} True
-
obj¶ Returns: set of all object pronouns used to describe the gender >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> fem_pronouns = PronounSeries('Fem', {'she', 'her', 'hers'}, subj='she', obj='her') >>> masc_pronouns = PronounSeries('Masc', {'he', 'him', 'his'}, subj='he', obj='him') >>> bigender = Gender('Bigender', [fem_pronouns, masc_pronouns]) >>> bigender.obj == {'him', 'her'} True
-
pronouns¶ Returns: A set containing all pronouns that this Gender uses >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> they_series = PronounSeries('They', {'they', 'them', 'theirs'}, subj='they', obj='them') >>> xe_series = PronounSeries('Xe', {'Xe', 'Xer', 'Xis'}, subj='xe', obj='xer') >>> androgynous = Gender('Androgynous', [they_series, xe_series]) >>> androgynous.pronouns == {'they', 'them', 'theirs', 'xe', 'xer', 'xis'} True
-
subj¶ Returns: set of all subject pronouns used to describe the gender >>> from gender_analysis import PronounSeries >>> from gender_analysis import Gender >>> fem_pronouns = PronounSeries('Fem', {'she', 'her', 'hers'}, subj='she', obj='her') >>> masc_pronouns = PronounSeries('Masc', {'he', 'him', 'his'}, subj='he', obj='him') >>> bigender = Gender('Bigender', [fem_pronouns, masc_pronouns]) >>> bigender.subj == {'he', 'she'} True
-
pronouns module¶
-
class
gender_analysis.gender.pronouns.PronounSeries(identifier, pronouns, subj, obj)¶ Bases:
objectA class that allows users to define a custom series of pronouns to be used in gender_analysis functions
-
__eq__(other)¶ Determines whether two PronounSeries are equal. Note that they are only equal if they have the same identifier and the exact same set of pronouns.
>>> from gender_analysis import PronounSeries >>> fem_series = PronounSeries('Fem', {'she', 'her', 'hers'}, subj='she', obj='her') >>> second_fem_series = PronounSeries('Fem', {'she', 'her', 'hers'}, subj='she', obj='her') >>> fem_series == second_fem_series True >>> masc_series = PronounSeries('Masc', {'he', 'him', 'his'}, subj='he', obj='him') >>> fem_series == masc_series False
Parameters: other – The PronounSeries object to compare Returns: True if the two series are the same, False otherwise.
-
__init__(identifier, pronouns, subj, obj)¶ Creates a new series of pronouns, designated by the given identifier. Pronouns are any collection of strings that can be used to identify someone.
subj and obj will be considered part of the pronoun series regardless of whether they are listed in pronouns.
Note that pronouns are case-insensitive.
Parameters: - identifier – String used to identify what the particular series represents
- pronouns – Iterable of Strings that are to be used as pronouns for this group
- subj – String used as the “subject” pronoun of the series
- obj – String used as the “object” pronoun of the series
-