Skip to content

Commit

Permalink
Merge pull request DaveChild#49 from repat/master
Browse files Browse the repository at this point in the history
Format README.md
  • Loading branch information
DaveChild authored Sep 12, 2018
2 parents e83d5f8 + 84694a0 commit 2948788
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,50 @@ Homographs are going to be impossible to calculate as they depend on context (i.
## Installation

### Using Composer

```json
{
"require": {
"davechild/textstatistics": "1.*"
}
}

(If using a version of PHP < 7.2, specify version 1.0.2.)
```

> If using a version of PHP < 7.2, specify version 1.0.2.
### Measuring Readability

use DaveChild\TextStatistics as TS;
$textStatistics = new TS\TextStatistics;
$text = 'The quick brown fox jumped over the lazy dog.';
echo 'Flesch-Kincaid Reading Ease: ' . $textStatistics->fleschKincaidReadingEase($text);
```php
use DaveChild\TextStatistics as TS;
$textStatistics = new TS\TextStatistics;
$text = 'The quick brown fox jumped over the lazy dog.';
echo 'Flesch-Kincaid Reading Ease: ' . $textStatistics->fleschKincaidReadingEase($text);
```

### More Text Shenanigans!

Included with this package are several classes with static methods which can be called independently. If required, you can pass a text encoding to these methods as a second parameter.

#### Pluralise and Singularise Words

echo DaveChild\TextStatistics\Pluralise::getPlural('banana'); // bananas
echo DaveChild\TextStatistics\Pluralise::getSingular('bananas'); // banana
```php
echo DaveChild\TextStatistics\Pluralise::getPlural('banana'); // bananas
echo DaveChild\TextStatistics\Pluralise::getSingular('bananas'); // banana
```

#### Count Syllables

echo DaveChild\TextStatistics\Syllables::syllableCount('banana'); // 3
```php
echo DaveChild\TextStatistics\Syllables::syllableCount('banana'); // 3
```

#### Letter, Sentence, Word Counts

echo DaveChild\TextStatistics\Text::textLength('I ate a banana.'); // 15
echo DaveChild\TextStatistics\Text::letterCount('I ate a banana.'); // 11
echo DaveChild\TextStatistics\Text::wordCount('I ate a banana.'); // 4
echo DaveChild\TextStatistics\Text::sentenceCount('I ate a banana.'); // 1
```php
echo DaveChild\TextStatistics\Text::textLength('I ate a banana.'); // 15
echo DaveChild\TextStatistics\Text::letterCount('I ate a banana.'); // 11
echo DaveChild\TextStatistics\Text::wordCount('I ate a banana.'); // 4
echo DaveChild\TextStatistics\Text::sentenceCount('I ate a banana.'); // 1
```

## Useful Links

Expand Down

0 comments on commit 2948788

Please sign in to comment.