Petrovich is the library which inflects Russian names to given grammatical case.
This is the Go port of https://github.com/petrovich.
go get github.com/striker2000/petrovich
All functions takes three arguments: name in nominative case, gender and grammatical case.
import "github.com/striker2000/petrovich"
n := petrovich.FirstName("Кузьма", petrovich.Male, petrovich.Genitive)
fmt.Print(n) // "Кузьмы"
n = petrovich.MiddleName("Сергеевич", petrovich.Male, petrovich.Instrumental)
fmt.Print(n) // "Сергеевичем"
n = petrovich.LastName("Петров-Водкин", petrovich.Male, petrovich.Prepositional)
fmt.Print(n) // "Петрове-Водкине"
Valid values for gender are petrovich.Androgynous
, petrovich.Male
and petrovich.Female
.
Full list of grammatical cases is in the table below.
Case | Case (in Russian) | Question (in Russian) |
---|---|---|
petrovich.Nominative |
Именительный | Кто? |
petrovich.Genitive |
Родительный | Кого? |
petrovich.Dative |
Дательный | Кому? |
petrovich.Accusative |
Винительный | Кого? |
petrovich.Instrumental |
Творительный | Кем? |
petrovich.Prepositional |
Предложный | О ком? |