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.
[] (https://travis-ci.org/petrovich/petrovich-java)
mvn -DskipTests=true clean package install
PetrovichDeclinationMaker maker = 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
PetrovichDeclinationMaker maker = PetrovichDeclinationMaker.getInstance();
maker.male.firstname().toGenitive("Иван"); //"Ивана"
maker.male.lastname().toInstrumental("Иванов"); //"Ивановым"
maker.female.middlename().toDative("Ивановна"); //"Ивановне"
You can replace default rules file with some custom one. Only JSON format supported by now.
PetrovichDeclinationMaker maker = PetrovichDeclinationMaker.getInstance("/path/to/custom/rules.file.json");
You can read about accuracy statistics in petrovich-ruby project front page
This project available under MIT license