Elixir library to inflect Russian first, last, and middle names.
def deps do
[
{:petrovich_elixir, "~> 1.0"}
]
endYes, you will need some basic Russian knowledge to work with this library. You need to understand how grammatical cases work in Russian language.
Petrovich.firstname!("Александр", :accusative)
# => Александра
Petrovich.middlename!("Сергеевич", :accusative)
# => Сергеевича
Petrovich.lastname!("Пушкин", :accusative, :male)
# => Пушкинаalias Petrovich.Detector
Detector.detect_gender("Александр", :firstname)
# => {:ok, "male"}You will need to add these lines into your config.exs:
config :petrovich_elixir,
rules_path: "rules/rules.json",
gender_path: "rules/gender.json",
json_codec: JasonYou can swap our default (Jason)
codec to any of your choice.
This package uses petrovich-rules as the source for all transformations. If you ever experience wrong result or other issues with the data itself, please open an issue here.
MIT. See LICENSE for details.