Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Petrovich petrovich-java

petrovich-java is library which inflects Russian names to given grammatical case. It supports first names, last names and middle names inflections.

petrovich-java is Java implementation of Petrovich ruby gem.

[Build Status] (https://travis-ci.org/petrovich/petrovich-java)

Building

mvn -DskipTests=true clean package install

Usage

PetrovichDeclinationMakermaker = PetrovichDeclinationMaker.getInstance();
maker.make(NamePart.FIRSTNAME, Gender.MALE, Case.GENITIVE, "Иван"); //Иванаmaker.make(NamePart.LASTNAME, Gender.MALE, Case.INSTRUMENTAL, "Иванов"); //Ивановымmaker.make(NamePart.MIDDLENAME, Gender.FEMALE, Case.DATIVE, "Ивановна"); //Ивановне

Also you can use more convenient syntax

PetrovichDeclinationMakermaker = PetrovichDeclinationMaker.getInstance();
maker.male.firstname().toGenitive("Иван"); //"Ивана"maker.male.lastname().toInstrumental("Иванов"); //"Ивановым"maker.female.middlename().toDative("Ивановна"); //"Ивановне"

Custom rule file

You can replace default rules file with some custom one. Only JSON format supported by now.

PetrovichDeclinationMakermaker = PetrovichDeclinationMaker.getInstance("/path/to/custom/rules.file.json");

Accuracy

You can read about accuracy statistics in petrovich-ruby project front page

License

This project available under MIT license

About

Library to inflect Russian first, last, and middle names. Java implementation of Petrovich.

Resources

Stars

20 stars

Watchers

18 watching

Forks

Releases

Packages

Used by

Contributors

Languages