NAME

Lingua::RU::Inflect - Inflect russian names.

VERSION

Version 0.06

DESCRIPTION

Lingua::RU::Inflect is a perl module that provides Russian linguistic procedures such as declension of given names (with some nouns and adjectives too), and gender detection by given name.

Choosing of proper forms of varying prepositions which added in 0.02 now is unavailable because it moved to Lingua::RU::Preposition.

SYNOPSIS

Inflects russian names which represented in UTF-8.

Perhaps a little code snippet.

use Lingua::RU::Inflect;

my @name = qw/Петрова Любовь Степановна/;
# Transliteration of above line is: Petrova Lyubov' Stepanovna

my $gender = detect_gender_by_given_name(@name);
# $gender == FEMININE

my @genitive = inflect_given_name(GENITIVE, @name);
# @genitive == qw/Петровой Любови Степановны/;
# Transliteration of above line is: Petrovoy Lyubovi Stepanovny

One-liners also can be used

perl -Ilib -Mcommon::sense -MLingua::RU::Inflect=:all \
-E 'say join " ", inflect_given_name(GENITIVE, qw/Перец Лев Ильич/)'
# Перца Льва Ильича
# Transliteration of above line is: Pertsa L'va Il'icha

TO DO

1. Inflect any nouns, any words, anything...

EXPORT

Function detect_gender_by_given_name and detect_gender_by_given_name are exported by default.

Also you can export only case names:

use Lingua::RU::Inflect qw/:cases/;

Or only subs and genders

use Lingua::RU::Inflect qw/:subs :genders/;

Or everything: subs, aliases, genders and case names:

use Lingua::RU::Inflect qw/:all/; # or
use Lingua::RU::Inflect qw/:cases :genders :subs/;

FUNCTIONS

detect_gender_by_given_name

Try to detect gender by name. Up to three arguments expected: lastname, firstname, patronym.

Return MASCULINE, FEMININE for successful detection or undef when function can't detect gender.

Detection rules

When name match some rule, rest of rules are ignored.

  1. Patronym (russian отчество — otchestvo), if presented, gives unambiguous detection rules: feminine patronyms ends with “na”, masculine ones ends with “ich” and “ych”.

  2. Most of russian feminine firstnames ends to vowels “a” and “ya”. Most of russian masculine firstnames ends to consonants.

    There's exists exceptions for both rules: feminine names such as russian name Lubov' (Любовь) and foreign names Ruf' (Руфь), Rachil' (Рахиль) etc. Masculine names also often have affectionate diminutive forms: Alyosha (Алёша) for Alexey (Алексей), Kolya (Коля) for Nickolay (Николай) etc. Some affectionate diminutive names are ambiguous: Sasha (Саша) is diminutive name for feminine name Alexandra (Александра) and for masculine name Alexander (Александр), Zhenya (Женя) is diminutive name for feminine name Eugenia (Евгения) and for masculine name Eugene (Евгений) etc.

    These exceptions are processed.

    When got ambiguous result, function try to use next rule.

  3. Most of russian lastnames derived from possessive nouns (and names). Feminine forms of these lastnames ends to “a”. Some lastnames derived from adjectives. Feminine forms of these lastnames ends to “ya”.

_inflect_given_name

Inflects name of given gender to given case. Up to 5 arguments expected: gender, case, lastname, firstname, patronym. Lastname, firstname, patronym must be in Nominative.

Returns list which contains inflected lastname, firstname, patronym.

inflect_given_name

Detects gender by given name and inflect parts of this name.

Expects for up to 4 arguments: case, lastname, firstname, patronym

Available cases are: NOMINATIVE, GENITIVE, DATIVE, ACCUSATIVE, INSTRUMENTAL, PREPOSITIONAL.

It returns list which contains inflected lastname, firstname, patronym

AUTHOR

Alexander Sapozhnikov, <shoorick at cpan.org>

BUGS

Please report any bugs or feature requests to bug-lingua-ru-inflect at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lingua-RU-Inflect. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Lingua::RU::Inflect

You can also look for information at:

SEE ALSO

Russian translation of this documentation available at RU/Lingua/RU/Inflect.pod

ACKNOWLEDGEMENTS

http://www.imena.org/declension.html and http://new.gramota.ru/spravka/letters/71-rubric-482 (in Russian) for rules of declension.

https://www.behindthename.com/ for directory of names.

COPYRIGHT & LICENSE

Copyright 2009-2018 Alexander Sapozhnikov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.