diff --git a/chapters.ent b/chapters.ent index d29aa54c76..8d48b73096 100644 --- a/chapters.ent +++ b/chapters.ent @@ -76,6 +76,7 @@ + diff --git a/functions/pspell.xml b/functions/pspell.xml new file mode 100644 index 0000000000..2665f87349 --- /dev/null +++ b/functions/pspell.xml @@ -0,0 +1,249 @@ + + Pspell functions + Pspell + + + + The pspell functions allows you to check the + spelling on a word and offer suggestions. + + + You need the aspell and pspell libraries, available from: &url.pspell;. + + + + + + pspell_new + Load a new dictionary + + + Description + + + int pspell_new + string language + string + + spelling + + + string + + jargon + + + string + + encoding + + + + + + Pspell_new opens up a new dictionary and + returns the dictionary link identifier for use in other pspell + functions. + + The language parameter is the language code which consists of the two + letter ISO 639 language code and an optional two letter ISO 3166 country + code after a dash or underscore. The spelling parameter is the requested + spelling for languages with more than one spelling such as English. Known + values are ``american'', ``britsh'', and ``canadian''. The jargon parameter + contains extra information two distinguish two different words lists that + have the same language-tag and spelling. The encoding parameter is the + encoding that words are expected to be in. Valid values are 'utf-8', + 'iso8859-*', 'koi8-r', 'viscii', 'cp1252', 'machine unsigned 16', + 'machine unsigned 32'. This parameter is largely untested, so be careful when + using. For more information and examples, check out inline manual pspell + website:&url.pspell;. + + + + <function>Pspell_new</function> + +$pspell_link = pspell_new("english"); + + + + + + + + + pspell_mode + Change spellchecking mode + + + Description + + + boolean pspell_mode + int dictionary_link + int mode + + + + pspell_mode changes the spellchecking mode. + + There are three modes available: + + + + PSPELL_FAST - Fast mode (least number of suggestions) + + + + + PSPELL_NORMAL - Normal mode (more suggestions) + + + + + PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions) + + + + + + + <function>Pspell_mode</function> + +$pspell_link = pspell_new("english"); +pspell_mode(PSPELL_FAST); + +if(!pspell_check ($pspell_link, "testt")){ + $suggestions = pspell_suggest($pspell_link, "testt"); +} + + + + + + + + + pspell_runtogether + Consider run-together words as legal compounds + + + Description + + + boolean pspell_runtogether + int dictionary_link + int mode + + + + pspell_runtogether Consider run-together words as + legal compounds. That is, "thecat" will be a legal compound, athough + there should be a space between the two words. Changing this setting + only affects the results returned by pspell_check(); pspell_suggest() + will still return suggestions, and they are not affected by the calls + to php_runtogether(). + + + + <function>Pspell_runtogether</function> + +$pspell_link = pspell_new("english"); +pspell_runtogether(true); +echo pspell_runtogether($pspell_link, "thecat") ? "correct" : "wrong"; + + + + + + + + + pspell_check + Check a word + + + Description + + + boolean pspell_check + int dictionary_link + string word + + + + pspell_check checks the spelling of a word + and returns true if the spelling is correct, false if not. + + + + <function>Pspell_check</function> + +$pspell_link = pspell_new("english"); + +if(pspell_check($pspell_link, "testt")){ + echo "This is a valid spelling"; +}else{ + echo "Sorry, wrong spelling"; +} + + + + + + + + + pspell_suggest + Suggest spellings of a word + + + Description + + + array pspell_suggest + int dictionary_link + string word + + + + Pspell_suggest returns an array of possible + spellings for the given word. + + + + <function>Pspell_suggest</function> + +$pspell_link = pspell_new("english"); + +if(!pspell_check ($pspell_link, "testt")){ + $suggestions = pspell_suggest($pspell_link, "testt"); + + for($i=0; $i < count ($suggestions); $i++){ + echo "Possible spelling: " . $suggestions[$i] . "<br>"; + } +} + + + + + + + + +