Skip to content

my-mail-ru/perl-MR-Petrovich-XS

Repository files navigation

NAME

MR::Petrovich::XS - Perl extension for libpetrovich

SYNOPSIS

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 )

DESCRIPTION

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.

CONSTANTS

KIND

  • KIND_FIRST_NAME
  • KIND_MIDDLE_NAME
  • KIND_LAST_NAME

GENDER

  • GENDER_MALE
  • GENDER_FEMALE
  • GENDER_ANDROGYNOUS

CASE

  • CASE_NOMINATIVE
  • CASE_GENITIVE
  • CASE_DATIVE
  • CASE_ACCUSATIVE
  • CASE_INSTRUMENTAL
  • CASE_PREPOSITIONAL

METHODS

  • 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 (see KIND_* constants), to choosen case (see CASE_* 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.

AUTHOR

Alexander Kazakov, [email protected]

COPYRIGHT AND LICENSE

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published