/gendex

Get gender from first name in Elixir.

Primary LanguageElixirMIT LicenseMIT

Gendex

Build Status Hex.pm

Gendex is an Elixir library that will tell you the most likely gender of a person based on their first name. It uses a UTF-8 encoded version of the underlying data from the program "gender" by Jorg Michael (described here).

Inspired by Gender Detector.

Installation

First, add Gendex to your mix.exs dependencies:

def deps do
  [{:gendex, "~> 0.5.0"}]
end

And start the Gendex application. For most projects (such as Phoenix apps) this will mean adding :gendex to the list of applications in mix.exs.

def application do
  [mod: {MyApp, []},
   applications: [:gendex, :other_apps...]]
end

Then, update your dependencies:

$ mix deps.get

Optionally, you can also set the path to your own nam_dict.txt (utf8 encoded) by adding this to your config:

config :gendex, dict_path: "/path/to/custom/dict"

Usage

Gendex.lookup("Bob")
#=> :male

Gendex.lookup("Sally")
#=> :female

Gendex.lookup("Pauley")
#=> :unisex

TODO

  • Country specific gender lookup