Comments (2)
Hello @Xoshbin
Thanks for giving a try to the library.
As the library is a wrapper around existing spellchecking engines, if the one you use supports RTL languages and Kurdish language then it should be fine.
As long as the Abjad characters are utf8 encoded the library doesn't get in your way.
If the 2 points above are not true, then it's a bug.
I'll investigate and come back to you.
from php-spellchecker.
I've tried persian with LanguageTools:
Start the spellchecking engine using docker:
docker run -d --rm -p 8010:8010 silviof/docker-languagetool
languagetools_persian_example.php
<?php
use PhpSpellcheck\Spellchecker\LanguageTool;
use PhpSpellcheck\Spellchecker\LanguageTool\LanguageToolApiClient;
require_once __DIR__ . '/../vendor/autoload.php';
// *** Using spellcheckers directly ***
$spellchecker = new LanguageTool(
new LanguageToolApiClient('http://localhost:8010')
); // Creates aspell spellchecker pointing to "aspell" as it's binary path
/** @var \PhpSpellcheck\Misspelling[]|\Generator $misspellings */
$misspellings = $spellchecker->check(<<<TEXT
لطفا متن خود را اینجا قرار دهید . یا بررسی کنید که این متن را برای دیدن بعضی بعضی از اشکال هایی که ابزار زبان توانسته تشخیس هدد. درباره ی نرم افزارهای بررسی کننده های گرامر چه فکر می کنید؟ لطفا در نظر داشته باشید که آنها بی نقص نمی باشند.
TEXT
, ['fa'], ['from' => 'languagetool spellchecker']);
foreach ($misspellings as $misspelling) {
print_r([
$misspelling->getWord(),
$misspelling->getLineNumber(),
$misspelling->getOffset(),
$misspelling->getSuggestions(),
$misspelling->getContext(),
]);
}
and it worked as expected ✔️
I've also tried with an arabic dictionary for hunspell
Install arabic hunspell dictionaries:
$ apt-get install hunspell-ar
<?php
use PhpSpellcheck\Spellchecker\Aspell;
require_once __DIR__ . '/../vendor/autoload.php';
// *** Using spellcheckers directly ***
$hunspell = \PhpSpellcheck\Spellchecker\Hunspell::create(); // Creates aspell spellchecker pointing to "aspell" as it's binary path
/** @var \PhpSpellcheck\Misspelling[]|\Generator $misspellings */
$misspellings = $hunspell->check('هدف مشروع آيسبل هو إنشاء قواميس في اللغة العربية للتطبيقات المكتبية الحرة مثل مجموعة أوبن أوفس', ['ar'], ['from' => 'aspell spellchecker']);
foreach ($misspellings as $misspelling) {
print_r([
$misspelling->getWord(),
$misspelling->getLineNumber(),
$misspelling->getOffset(),
$misspelling->getSuggestions(),
$misspelling->getContext(),
]);
}
and it worked too ✔️
I would advise to make sure the spellchecking engine you chose is working as expected by running it through the command line first.
Then if it works on the command line and not through the library please feel free to reopen the issue. Meanwhile I'll close it 🙂
from php-spellchecker.
Related Issues (11)
- Action Required: Fix Renovate Configuration
- Process with command "'hunspell' '-a' '-d' 'en_US'" has failed running with exit code 1(General error) HOT 10
- Hunspell class doesn't work in web HOT 2
- Utf8 issue not fixed in master HOT 1
- Dependency Dashboard
- t() function in src/Text/functions.php prevents use with Drupal HOT 3
- Process with command "'aspell' '--encoding' 'utf-8' '-a' '--lang=en_US'" has failed running with exit code 127 HOT 2
- Process with command "aspell --encoding utf-8 -a --lang=en_US" has failed running with exit code 1 on Windows HOT 2
- file_get_contents error with Portuguese and Deutch HOT 1
- Possible error in hunspell.php HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-spellchecker.