uxmsdevs / didyoumean
Provides correct word suggestions based on a dictionary by levenshtein function
dev-master
2016-03-23 15:45 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-12-13 20:03:45 UTC
README
Provides correct word suggestions based on a dictionary by levenshtein function.
dictionaries directory can be populated for supporting multilanguage suggestions
Usage
use Uxms\DidYouMean\MatchWord;
$dym = new MatchWord('en', 'Banana'); echo $dym->checkMatch();
OR
$dym = new MatchWord; $dym->setLanguage('en')->setWord('Banana'); echo $dym->checkMatch();
OR
$dym = new MatchWord; $dym->setLanguage('en'); $dym->setWord('Banana'); echo $dym->checkMatch();
Returns
Returns json encoded array like:
{"status":1,"description":"Exact match","closest":"banana"}
or if not matched:
{"status":0,"description":"Did you mean","closest":"banana"}