Git Product home page Git Product logo

petrovich_elixir's Introduction

petrovic_elixir

petrovich

test Coverage Status Hex Version License

Elixir library to inflect Russian first, last, and middle names.

Installation

def deps do
  [
    {:petrovich_elixir, "~> 1.0"}
  ]
end

Usage

Do I need to know Russian to use it?

Yes, you will need some basic Russian knowledge to work with this library. You need to understand how grammatical cases work in Russian language.

Inflection

Petrovich.firstname!("Александр", :accusative)
# => Александра

Petrovich.middlename!("Сергеевич", :accusative)
# => Сергеевича

Petrovich.lastname!("Пушкин", :accusative, :male)
# => Пушкина

Gender detection

alias Petrovich.Detector

Detector.detect_gender("Александр", :firstname)
# => {:ok, "male"}

Configuration

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: Jason

You can swap our default (Jason) codec to any of your choice.

Rules

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.

License

MIT. See LICENSE for details.

petrovich_elixir's People

Contributors

dependabot-preview[bot] avatar dustalov avatar ppraisethesun avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

petrovich_elixir's Issues

Use tuple as a result

Right now only a value returns.
We should also include bang! versions with exceptions.

PetrovichElixir?

I believe you can use just Petrovich instead of PetrovichElixir.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.