<commit_before>a-vs-an
=======

PHP port of http://home.nerbonne.org/A-vs-An/<commit_msg>Update readme with instructions and sample usage<commit_after>AvsAn Symfony Bundle
====================

PHP port of http://home.nerbonne.org/A-vs-An/

## Installation
With [composer](http://getcomposer.org), add this repository to the repositories array:
```json
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/UseAllFive/a-vs-an.git"
        }
    ]
}
```
Add it to the require hash of your composer.json
```json
{
    "require": {
        "useallfive/a-vs-an": "dev-master"
    }
}
```

### Symfony 2
Add the bundle to your `AppKernel#registerBundles()` method.
```php
$bundles = array(
    // ...
    new UseAllFive\AvsAnBundle\UseAllFiveAvsAnBundle(),
);
```

## Sample usage
### Symfony 2
```php
class DefaultController extends Controller
{
    public function defaultAction()
    {
        $aVsAn = $this->get('a_vs_an');
        $result = $aVsAn->query('0800 number');
    }
}
```
```php
print_r($result);
```

```php
Array
(
    [aCount] => 8
    [anCount] => 25
    [prefix] => 08
    [article] => an
)
```
{'fraction_non_alphanumeric': 0.19360414866032843, 'fraction_numerical': 0.00950734658599827, 'mean_word_length': 2.95221843003413, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '435884', 'n_tokens_mistral': 434, 'n_tokens_neox': 400, 'n_words': 89}