#name #inflection #russian #case #first #last #middle

petrovich

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

3 unstable releases

0.2.0 Apr 6, 2020
0.1.1 May 23, 2016
0.1.0 Feb 16, 2016

#4 in #middle

MIT license

29KB
643 lines

Petrovich-rs

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

Petrovich-rs is Rust implementation of Petrovich ruby gem.

Usage

This crate is on crates.io and can be used by adding petrovich to the dependencies in your project's Cargo.toml.

[dependencies]

petrovich = "0.2"

Examples

use petrovich::*;

fn main() {
    assert_eq!(firstname(Gender::Male, "Саша", Case::Dative), "Саше");
    assert_eq!(firstname(Gender::Female, "Изабель", Case::Genitive), "Изабель");

    assert_eq!(lastname(Gender::Male, "Станкевич", Case::Prepositional), "Станкевиче");
    assert_eq!(lastname(Gender::Female, "Станкевич", Case::Prepositional), "Станкевич");

    assert_eq!(middlename(Gender::Male, "Сергеич", Case::Instrumental), "Сергеичем");
    assert_eq!(middlename(Gender::Female, "Прокопьевна", Case::Accusative), "Прокопьевну");
}

No runtime deps

~0–250KB