tigitz /
php-spellchecker
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | use PhpSpellcheck\MisspellingFinder; |
||
| 6 | use PhpSpellcheck\MisspellingHandler\EchoHandler; |
||
| 7 | use PhpSpellcheck\Spellchecker\Aspell; |
||
| 8 | |||
| 9 | require_once __DIR__ . '/../vendor/autoload.php'; |
||
| 10 | |||
| 11 | $misspellingFinder = new MisspellingFinder( |
||
| 12 | Aspell::create(), // Creates aspell spellchecker pointing to "aspell" as it's binary path |
||
| 13 | new EchoHandler() // Handles all the misspellings found by echoing their information |
||
| 14 | ); |
||
| 15 | /** @var \Generator|\PhpSpellcheck\Misspelling[] $misspellings */ |
||
| 16 | $misspellings = $misspellingFinder->find( |
||
| 17 | new \PhpSpellcheck\Source\MultiSource( |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 18 | [ |
||
| 19 | new \PhpSpellcheck\Source\File(__DIR__ . '/../tests/Fixtures/Text/mispelling1.txt'), |
||
| 20 | new \PhpSpellcheck\Source\Directory(__DIR__ . '/../tests/Fixtures/Text/Directory'), |
||
| 21 | ] |
||
| 22 | ), |
||
| 23 | ['en_US'], |
||
| 24 | ['from' => 'aspell spellchecker'] |
||
| 25 | ); |
||
| 26 |