note 128850 added to function.pspell-config-create

From: Date: Sat, 02 Sep 2023 04:09:39 +0000
Subject: note 128850 added to function.pspell-config-create
Groups: php.notes 
Request: Send a blank email to php-notes+get-220811@lists.php.net to get a copy of this message
This might help if you are trying to use multiple custom dictionaries especially if you don't have sudo access to the system aspell dictionary directory ... I created three custom dictionaries (or are they word lists) using "aspell create master" and found a way to use them ... 1) Create 3 word lists, one word per line, wordlistA.txt, wordlistB.txt, and wordlistC.txt. 2) Create 3 masters ... aspell --lang=en create master ./my_LANG-dictA.rws < wordlistA.txt - repeat for B and C (lang needs to be already installed, I think any lang will work). 3) Create 3 multi files, my_LANGA.multi, contents: add my_LANG-dictA.rws) - repeat for B and C. Where my_LANGA can be any name in the same case as explained in the aspell manual. 4) Use any one of them (A B or C) with pspell ... <?php $pspell_config = pspell_config_create('my_LANGC', '', ''. 'utf-8'); pspell_config_dict_dir($pspell_config, <location of my_LANGC.multi>); if (($pspell = pspell_new_config($pspell_config)) == false) { echo 'pspell_new_config() for LANGC FAILED!'); } else { $word = 'PHPisgreat']; if (pspell_check($pspell, $word)) { echo "$word: Valid spelling"; } else { $suggestions = pspell_suggest($pspell, $word); echo "$word: suggestions: $suggestions" } } ?> The language arg for pspell_config_create() is the basename of the .multi file. Note that I do not have a file $HOME/.aspell.conf. Note that my .multi and .rws files are in the same directory, which I think is necessary. The wordlist files are not needed once the masters are created. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 108.185.120.162) ---- Manual Page -- https://php.net/manual/en/function.pspell-config-create.php Edit -- https://main.php.net/note/edit/128850 Del: integrated -- https://main.php.net/note/delete/128850/integrated Del: useless -- https://main.php.net/note/delete/128850/useless Del: bad code -- https://main.php.net/note/delete/128850/bad+code Del: spam -- https://main.php.net/note/delete/128850/spam Del: non-english -- https://main.php.net/note/delete/128850/non-english Del: in docs -- https://main.php.net/note/delete/128850/in+docs Del: other reasons-- https://main.php.net/note/delete/128850 Reject -- https://main.php.net/note/reject/128850 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220811) next »