ecommercebox/vocative-polish-firstname
Composer 安装命令:
composer require ecommercebox/vocative-polish-firstname
包简介
Component for remake first name to Polish vocative. Odmiana polskich imion na wołacz
README 文档
README
Component for remake first name to Polish vocative
Installation
Install the library by adding it to your composer.json or running:
composer require "ecommercebox/vocative-polish-firstname:*"
How to use
Create object with first name, you can setup encoding and own "titles" as optional arguments. First name is converted to first letter up.
//required $input = 'MARIUSZ'; //optional $encoding = "UTF-8"; //default group ['U' => 'Panie/Pani', 'M' => 'Panie', 'W' => 'Pani']; //override default group titles $titles = ['U' => '', 'M' => 'Drogi Panie', 'W' => 'Droga Pani']; //override or add new exeptions, where W = Woman, M = Man $exeptions = [ 'Ola' => ['W', 'Oluu'], 'Jan' => ['M', 'Janku'] ]; //init object $name = new \ecbox\VocativePolishFirstName($input, $encoding, $titles, $exeptions);
Setup additional titles group
$titles = ['U' => 'Szanowna(y) Pani(e)', 'M' => 'Szanowny Panie', 'W' => 'Szanowna Pani']; $name->setTitles($titles, 'polite');
Get vocative first name with default title definition. Optional argument $delimiter, default is space and title definition group name
echo $name->getVocativeString(); // output: Drogi Panie Mariuszu
Get vocative first name with custom title definition. Optional argument $delimiter, default is space and title definition group name
echo $name->getVocativeString('polite'); // output: Szanowny Panie Mariuszu
Get vocative first name
echo $name->getVocativeFirstName(); // output: Mariuszu
Get default title for first name
echo $name->getDetectedTitle(); // output: Drogi Panie
Get custom group title for first name
echo $name->getDetectedTitle('polite'); // output: Szanowny Panie
Check if male
echo $name->isMale(); // output: true if yes
Check if woman
echo $name->isWoman(); // output: true if yes
Get array
$array = $name->getVocativeArray(); // array: ['M', "Mariuszu"]; // where M: Male, W: Woman, U: Unknown
Test results
You can check quality using test file: testVocativePolishFirstName
We are using dictionary test. See results!
Test date: 2016-07-11
Total dictionary names: 1704
Differences: 0
The percentage of errors: 0%
License
MIT license. See the LICENSE file for more details.
统计信息
- 总下载量: 52.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-27