beauvoir 0.0.1a

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+
2
+
3
+ class Name
4
+ attr_accessor :male_count, :female_count, :name
5
+
6
+ def initialize(name)
7
+ @male_count = 0
8
+ @female_count = 0
9
+ @name = name
10
+ end
11
+
12
+ def male?
13
+ @male_count > @female_count
14
+ end
15
+
16
+ def female?
17
+ @female_count > @male_count
18
+ end
19
+
20
+ def gender
21
+ female? ? :female : male? ? :male : :unknown #oh god this is unreadable
22
+ end
23
+
24
+ def female_proportion
25
+ return 0 unless self.total > 0
26
+ @female_count / self.total
27
+ end
28
+
29
+ def male_proportion
30
+ return 0 unless self.total > 0
31
+ @male_count / self.total
32
+ end
33
+
34
+ def total
35
+ (@male_count + @female_count).to_f
36
+ end
37
+
38
+ #implements Agresti-Coull binomial confidence interval, returns lower bound of higher of male/female
39
+ # cf. http://codesequoia.wordpress.com/2010/12/06/unit-test-and-statistics/
40
+ def lower
41
+ nt = total + 1.96 ** 2
42
+ pt = ([@male_count, @female_count].max + (1.96 ** 2) / 2) / nt
43
+ e = 1.96 * Math.sqrt(pt * (1 - pt) / nt)
44
+ [female_proportion, male_proportion].max - e
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: beauvoir
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1a
5
+ platform: ruby
6
+ authors:
7
+ - Jeremy B. Merrill
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |-
14
+ Guess gender by a first name using more detailed, better
15
+ sourced data from Open Gender Tracker's Global Name Data.
16
+ Beauvoir lets you set avg and lower bounds and choose
17
+ countries from which to draw data.
18
+
19
+ It's important to note that many people identify as neither
20
+ a men nor a women. It's important, too, to note that many
21
+ people who do identify as male or female have names that
22
+ are held by far more people who identify as another gender.
23
+ All of these people deserve not to be misgendered in public
24
+ (or in private).
25
+
26
+ Nevertheless, automatically classifying people by apparent
27
+ gender can be a very useful tool to perform censuses of
28
+ communities or publications to detect and quantify
29
+ perhaps-invisible bias. VIDA is a pioneer in this field,
30
+ but their "Count" is limited by a manual methodology that
31
+ depends hundreds of person-hours of labor. There is a place
32
+ for more automated counts and Beauvoir can help, but if you
33
+ do a count like this, you should be careful in how you word
34
+ your findings not to misgender anyone in particular and be
35
+ responsive to the possibility of errors.
36
+ email: jeremybmerrill@jeremybmerrill.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - lib/beauvoir.rb
42
+ - lib/name.rb
43
+ - LICENSE
44
+ - README.md
45
+ - lib/data/ukprocessed.csv
46
+ - lib/data/usprocessed.csv
47
+ homepage: http://rubygems.org/gems/beauvoir
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - '>'
63
+ - !ruby/object:Gem::Version
64
+ version: 1.3.1
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 2.0.2
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: Guess a person's gender by their first name
71
+ test_files: []
72
+ has_rdoc: