MR::Petrovich::XS - Perl extension for libpetrovich
use MR::Petrovich::XS;
$petr = MR::Petrovich::XS->instance();
$petr = MR::Petrovich::XS->instance(config_path => $path_to_yml_config);
MR::Petrovich::XS->inflect_first_name( $name, $gender, $case )
MR::Petrovich::XS->inflect_last_name( $name, $gender, $case )
MR::Petrovich::XS->inflect_middle_name( $name, $gender, $case )
MR::Petrovich::XS provides an interface to libpetrovich
library (see https://github.com/my-mail-ru/petrovich-c), which allows you inflect Russian first, last and middle names.
Inflect rules are given from YAML file. This file can be found here https://github.com/my-mail-ru/petrovich-rules.
- KIND_FIRST_NAME
- KIND_MIDDLE_NAME
- KIND_LAST_NAME
- GENDER_MALE
- GENDER_FEMALE
- GENDER_ANDROGYNOUS
- CASE_NOMINATIVE
- CASE_GENITIVE
- CASE_DATIVE
- CASE_ACCUSATIVE
- CASE_INSTRUMENTAL
- CASE_PREPOSITIONAL
-
instance(%p)
Makes instance of MR::Petrovich::XS.
%p
accepts only one parameter -config_path
, that defines path to rules config file. Default path is/usr/local/etc/petrovich/rules.yml
-
OBJ->inflect_name($name, $kind, $gender, $case)
Inflect male or female (see
GENDER_*
constants)$name
, that can be first, last or middle part of name (seeKIND_*
constants), to choosen case (seeCASE_*
constants). Method returns inflected name if result is successful, or original name otherwise. -
OBJ->inflect_first_name($name, $gender, $case)
Same as
inflect_name
, but for first names only. -
OBJ->inflect_middle_name($name, $gender, $case)
Same as
inflect_name
, but for middle names only. -
OBJ->inflect_last_name($name, $gender, $case)
Same as
inflect_name
, but for last names only.
Alexander Kazakov, [email protected]
Copyright (C) 2016 by Alexander Kazakov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.