Need help with gender_detector?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

bmuller
422 Stars 39 Forks GNU General Public License v3.0 36 Commits 5 Opened issues

Description

Get gender from first name in Ruby.

Services available

!
?

Need anything else?

Contributors list

# 96,434
Elixir
absinth...
GraphQL
Erlang
12 commits
# 242,044
Ruby
Shell
swt
mac-osx
3 commits
# 288,542
HTML
CSS
bootstr...
2 commits
# 459,580
Clojure
HTML
Shell
1 commit
# 8,609
Swift
snapsho...
Homebre...
functio...
1 commit
# 585,910
Ruby
1 commit
# 205,987
HTML
ctr
cbc
Rails
1 commit
# 70,144
Ruby
HTML
Rails
devise
1 commit

= Gender Detector {Build Status}[https://travis-ci.org/bmuller/gender_detector]

Gender Detector is a Ruby library that will tell you the most likely gender of a person based on first name. It uses the underlying data from the program "gender" by Jorg Michael (described {here}[http://www.autohotkey.com/community/viewtopic.php?t=22000]).

== Installation

Add this line to your application's Gemfile:

gem 'gender_detector'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gender_detector

== Usage

Its use is pretty straightforward:

require 'genderdetector' d = GenderDetector.new d.getgender("Bob") :male d.getgender("Sally") :female d.getgender("Pauley") # should be androgynous :andy

The result will be one of andy (androgynous), male, female, mostlymale, or mostlyfemale. Any unknown names are considered andies.

I18N is supported if either UnicodeUtils or ActiveSupport are present. To get I18n support, add either one to your Gemfile:

gem 'unicode_utils' # or gem 'activesupport'

Afterwards, gender detection will work for names with non-ASCII characters as well:

d.get_gender("Álfrún") :female

Additionally, you can give preference to specific countries:

d.getgender("Jamie") => :female d.getgender("Jamie", :greatbritain) => :mostlymale

If you have an alterative data file, you can pass that in as an optional filename argument to the GenderDetector. Additionally, you can create a detector that is not case sensitive (default is to be case sensitive):

d = GenderDetector.new(:casesensitive => false) d.getgender "sally" => :female d.get_gender "Sally" => :female

Try to avoid creating many GenderDetectors, as each creation means reading in the data file.

= Licenses The genderdetector code is distributed under the GPLv3. The data file namdict.txt is released under the GNU Free Documentation License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.