Lingua::RU::Inflect - Inflect russian names.
Version 0.05
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.
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
1. Inflect any nouns, any words, anything...
Function detect_gender_by_given_name and detect_gender_by_given_name are exported by default.
detect_gender_by_given_name
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 only short aliases for subs
use Lingua::RU::Inflect qw/:short/;
Or everything: subs, aliases, genders and case names:
use Lingua::RU::Inflect qw/:all/; # or use Lingua::RU::Inflect qw/:cases :genders :subs :short/;
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.
MASCULINE
FEMININE
undef
When name match some rule, rest of rules are ignored.
Patronym (russian отчество — otchestvo), if presented, gives unambiguous detection rules: feminine patronyms ends with “na”, masculine ones ends with “ich” and “ych”.
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.
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”.
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.
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.
NOMINATIVE
GENITIVE
DATIVE
ACCUSATIVE
INSTRUMENTAL
PREPOSITIONAL
It returns list which contains inflected lastname, firstname, patronym
Alexander Sapozhnikov, <shoorick at cpan.org>
<shoorick at cpan.org>
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.
bug-lingua-ru-inflect at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Lingua::RU::Inflect
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Lingua-RU-Inflect
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Lingua-RU-Inflect
CPAN Ratings
http://cpanratings.perl.org/d/Lingua-RU-Inflect
Search CPAN
http://search.cpan.org/dist/Lingua-RU-Inflect/
Public repository at github
https://github.com/shoorick/lingua-ru-inflect
Russian translation of this documentation available at RU/Lingua/RU/Inflect.pod
http://www.imena.org/declension.html (in Russian) for rules of declension.
Copyright 2009-2014 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.
To install Lingua::RU::Inflect, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::RU::Inflect
CPAN shell
perl -MCPAN -e shell install Lingua::RU::Inflect
For more information on module installation, please visit the detailed CPAN module installation guide.