downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

pspell_config_dict_dir> <pspell_config_create
Last updated: Fri, 14 Aug 2009

view this page in

pspell_config_data_dir

(PHP 5)

pspell_config_data_dirDossier qui contient les fichiers de données linguistiques

Description

bool pspell_config_data_dir ( int $conf , string $directory )

Avertissement

Cette fonction n'est pas documentée et seule la liste des arguments est disponible.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès, FALSE en cas d'échec.



add a note add a note User Contributed Notes
pspell_config_data_dir
alexxed at gmail dot com
15-Oct-2007 07:21
Here's an example of how to use pspell when you don't want or you can't use the dictionaries installed on the system.
<?
$text_to_check
= 'I can sspeak English';
// optional. clean text a bit
$clean_text_to_check = preg_replace('/[^a-z0-9\-\.!;]+/i', ' ', $text_to_check);
// get a word list
$word_list = preg_split('/\s+/', $clean_text_to_check);

$pspell_config = pspell_config_create("en", null, null, 'utf-8');

// if the aspell dictionaries that you want are not installed,
// copy the aspell dictionaries and set the path to the dictionaries here
pspell_config_data_dir($pspell_config, "/home/alex/dictionaries/");
pspell_config_dict_dir($pspell_config, "/home/alex/dictionaries/");
$pspell_link = pspell_new_config($pspell_config);

foreach(
$word_list as $word) {

    if (!
pspell_check($pspell_link, trim($word))) {
       
$suggestions = pspell_suggest($pspell_link, trim($word));

        echo
$word . ' misspelled <br />';
        foreach (
$suggestions as $suggestion) {
            echo
"\t Possible spelling: $suggestion <br />";
        }
    }
    else {
       
// correct spelling
   
}
}
?>

pspell_config_dict_dir> <pspell_config_create
Last updated: Fri, 14 Aug 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites