From 4c4d1d6afc9d51a3cf130afd3385d524df019176 Mon Sep 17 00:00:00 2001 From: tigitz Date: Sun, 7 Feb 2021 02:46:37 +0100 Subject: [PATCH] Add missing jamspell doc --- docs/docs/spellcheckers/jamspell.html | 307 ++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 docs/docs/spellcheckers/jamspell.html diff --git a/docs/docs/spellcheckers/jamspell.html b/docs/docs/spellcheckers/jamspell.html new file mode 100644 index 0000000..d50169b --- /dev/null +++ b/docs/docs/spellcheckers/jamspell.html @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JamSpell - PHP-Spellchecker Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ +
+
+

JamSpell

+

JamSpell is a modern spellchecking library. It is light-weight, fast and accurate. It considers word surroundings to make better corrections.

+

Install

+

Follow instructions on https://github.com/bakwc/JamSpell

+

Or use a dockerized version, you can find the one used for PHP-Spellchecker test here https://github.com/tigitz/php-spellchecker/tree/jamspell/docker/jamspell

+

Usage

+

Spellcheck

+
<?php
+
+// Any object implementing \Psr\Http\Client\ClientInterface
+$httpClient = new Psr18Client();
+
+$jamSpell= new JamSpell($httpClient, 'http://jamspell:8080/candidates');
+
+// en_US aspell dictionary is available
+$misspellings = $jamSpell->check('mispell', ['en_US'], ['from_example']);
+foreach ($misspellings as $misspelling) {
+    $misspelling->getWord(); // 'mispell'
+    $misspelling->getLineNumber(); // '1'
+    $misspelling->getOffset(); // '0'
+    $misspelling->getSuggestions(); // ['misspell', ...]
+    $misspelling->getContext(); // ['from_example']
+}
+

Or if you want to check a file instead:

+
<?php
+// spellchecking a file
+$misspellings = $jamSpell->check(new File('path/to/file.txt'), ['en_US'], ['from_file']);
+foreach ($misspellings as $misspelling) {
+    $misspelling->getWord();
+    $misspelling->getLineNumber();
+    $misspelling->getOffset();
+    $misspelling->getSuggestions();
+    $misspelling->getContext();
+}
+

Available dictionaries

+

Jamspell doesnt provide a way to retrieve available dictionaries for now.

+

Check the tests for more examples.

+
+
+
+ +