Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wapmorgan committed Feb 3, 2017
1 parent d9ec4a3 commit 8d4ba34
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Tests & Quality: [![Build Status](https://travis-ci.org/wapmorgan/Morphos.svg)](
3. Last names
4. Nouns
2. Pluralization
3. Cases
3. Number creation
4. Cases
4. English
1. Pluralization
5. Addition of new languages
Expand Down Expand Up @@ -71,6 +72,7 @@ morphos\
LastNamesDeclension
GeneralDeclension
Plurality
CardinalNumber
```

## Declension
Expand Down Expand Up @@ -288,7 +290,6 @@ var_dump($dec->getForms('линейка', false));
*/
```


## Pluralization (`Plurality`)
_Pluralization nouns in Russian._

Expand Down Expand Up @@ -344,6 +345,56 @@ echo $count.' '.Plurality::pluralize($word, $count, false);
// result: 10 домов
```

## Number creation

All number creation classes are similar and have two common methods:

- `string getForm($number, $case)` - Get one form of a number.
- `array getForms($number)` - Get all forms of a number.

### Cardinal numbers (`CardinalNumber`)

_Declension of middle names in russian language._

Create declension class object:

```php
use morphos\Russian\CardinalNumber;
use morphos\Russian\Cases;

$cardinal = new CardinalNumber();
```

Get text representation of a number:

```php
$number = 4351;

$numeral = $cardinal->getForm($number, Cases::IMENIT); // четыре тысячи триста пятьдесят один
```

If you need all forms, you can get all forms of a name:

```php
var_dump($cardinal->getForms($number));
/* Will produce something like
array(6) {
["nominativus"]=>
string(66) "четыре тысячи триста пятьдесят один"
["genetivus"]=>
string(74) "четырех тысяч трехсот пятидесяти одного"
["dativus"]=>
string(80) "четырем тысячам тремстам пятидесяти одному"
["accusative"]=>
string(66) "четыре тысячи триста пятьдесят один"
["ablativus"]=>
string(90) "четырьмя тысячами тремястами пятьюдесятью одним"
["praepositionalis"]=>
string(81) "о четырех тысячах трехстах пятидесяти одном"
}
*/
```

## Cases (`Cases`)
Cases in russian language:

Expand Down

0 comments on commit 8d4ba34

Please sign in to comment.