diff --git a/functions/pspell.xml b/functions/pspell.xml index 271f1bad90..2c699490d2 100644 --- a/functions/pspell.xml +++ b/functions/pspell.xml @@ -1,4 +1,6 @@ - + + + Pspell Functions Pspell @@ -6,7 +8,7 @@ These functions allow you to check the spelling of a word and offer - suggestions. + suggestions. You need the aspell and pspell libraries, available from pspell_add_to_personal - Add the word to a personal wordlist. + Add the word to a personal wordlist Description @@ -33,11 +35,11 @@ pspell_add_to_personal adds a word to the personal - wordlist. If you used pspell_new_config with - pspell_config_personal to open the dictionary, - you can save the wordlist later with - pspell_save_wordlist. Please, note that this function - will not work unless you have pspell .11.2 and aspell .32.5 or later. + wordlist. If you used pspell_new_config with + pspell_config_personal to open the dictionary, + you can save the wordlist later with + pspell_save_wordlist. Please, note that this function + will not work unless you have pspell .11.2 and aspell .32.5 or later. @@ -58,8 +60,8 @@ pspell_save_wordlist ($pspell_link); pspell_add_to_session - Add the word to the wordlist in the current session. - + Add the word to the wordlist in the current session + Description @@ -72,8 +74,8 @@ pspell_save_wordlist ($pspell_link); pspell_add_to_session adds a word to the wordlist - associated with the current session. It is very similar to - pspell_add_to_personal + associated with the current session. It is very similar to + pspell_add_to_personal @@ -116,7 +118,7 @@ if (pspell_check ($pspell_link, "testt")) { pspell_clear_session - Clear the current session. + Clear the current session Description @@ -128,8 +130,8 @@ if (pspell_check ($pspell_link, "testt")) { pspell_clear_session clears the current session. - The current wordlist becomes blank, and, for example, if you try to save - it with pspell_save_wordlist, nothing happens. + The current wordlist becomes blank, and, for example, if you try to save + it with pspell_save_wordlist, nothing happens. @@ -141,7 +143,7 @@ $pspell_link = pspell_new_config ($pspell_config); pspell_add_to_personal ($pspell_link, "Vlad"); pspell_clear_session ($pspell_link); -pspell_save_wordlist ($pspell_link); //"Vlad" will not be saved +pspell_save_wordlist ($pspell_link); //"Vlad" will not be saved @@ -151,7 +153,7 @@ pspell_save_wordlist ($pspell_link); //"Vlad" will not be saved pspell_config_create - Create a config used to open a dictionary. + Create a config used to open a dictionary Description @@ -178,13 +180,13 @@ pspell_save_wordlist ($pspell_link); //"Vlad" will not be saved pspell_config_create has a very similar syntax to - pspell_new. In fact, using - pspell_config_create immediatelly followed by - pspell_new_config will produce the exact same result. - However, after creating a new config, you can also use - pspell_config_* functions before calling - pspell_new_config to take advantage of some - advanced functionality. + pspell_new. In fact, using + pspell_config_create immediatelly followed by + pspell_new_config will produce the exact same result. + However, after creating a new config, you can also use + pspell_config_* functions before calling + pspell_new_config to take advantage of some + advanced functionality. The language parameter is the language code which consists of the @@ -214,17 +216,19 @@ pspell_save_wordlist ($pspell_link); //"Vlad" will not be saved - PSPELL_FAST - Fast mode (least number of suggestions) + PSPELL_FAST - Fast mode (least number of + suggestions) - PSPELL_NORMAL - Normal mode (more suggestions) + PSPELL_NORMAL - Normal mode (more suggestions) - PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions) + PSPELL_BAD_SPELLERS - Slow mode (a lot of + suggestions) @@ -250,7 +254,7 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); pspell_config_ignore - Ignore words less than N characters long. + Ignore words less than N characters long Description @@ -263,9 +267,9 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); pspell_config_ignore should be used on a config - before calling pspell_new_config. This function - allows short words to be skipped by the spellchecker. Words less then - n characters will be skipped. + before calling pspell_new_config. This function + allows short words to be skipped by the spellchecker. Words less then + n characters will be skipped. @@ -274,7 +278,7 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); $pspell_config = pspell_config_create ("en"); pspell_config_ignore($pspell_config, 5); $pspell_link = pspell_new_config($pspell_config); -pspell_check($pspell_link, "abcd"); //will not result in an error +pspell_check($pspell_link, "abcd"); //will not result in an error @@ -284,7 +288,7 @@ pspell_check($pspell_link, "abcd"); //will not result in an error pspell_config_mode - Change the mode number of suggestions returned. + Change the mode number of suggestions returned Description @@ -297,27 +301,29 @@ pspell_check($pspell_link, "abcd"); //will not result in an error pspell_config_mode should be used on a config - before calling pspell_new_config. This function - determines how many suggestions will be returned by - pspell_suggest. - - + before calling pspell_new_config. This function + determines how many suggestions will be returned by + pspell_suggest. + + The mode parameter is the mode in which spellchecker will work. There are several modes available: - PSPELL_FAST - Fast mode (least number of suggestions) + PSPELL_FAST - Fast mode (least number of + suggestions) - PSPELL_NORMAL - Normal mode (more suggestions) + PSPELL_NORMAL - Normal mode (more suggestions) - PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions) + PSPELL_BAD_SPELLERS - Slow mode (a lot of + suggestions) @@ -339,7 +345,7 @@ pspell_check($pspell_link, "thecat"); pspell_config_personal - Set a file that contains personal wordlist. + Set a file that contains personal wordlist Description @@ -352,14 +358,14 @@ pspell_check($pspell_link, "thecat"); pspell_config_personal should be used on a config - before calling pspell_new_config. The personal - wordlist will be loaded and used in addition to the standard one after - you call pspell_new_config. If the file does not - exist, it will be created. The file is also the file where - pspell_save_wordlist will save personal wordlist to. - The file should be writable by whoever php runs as (e.g. nobody). Please, - note that this function will not work unless you have pspell .11.2 and - aspell .32.5 or later. + before calling pspell_new_config. The personal + wordlist will be loaded and used in addition to the standard one after + you call pspell_new_config. If the file does not + exist, it will be created. The file is also the file where + pspell_save_wordlist will save personal wordlist to. + The file should be writable by whoever php runs as (e.g. nobody). Please, + note that this function will not work unless you have pspell .11.2 and + aspell .32.5 or later. @@ -378,7 +384,7 @@ pspell_check ($pspell_link, "thecat"); pspell_config_repl - Set a file that contains replacement pairs. + Set a file that contains replacement pairs Description @@ -391,15 +397,15 @@ pspell_check ($pspell_link, "thecat"); pspell_config_repl should be used on a config - before calling pspell_new_config. The replacement - pairs improve the quality of the spellchecker. When a word is misspelled, - and a proper suggestion was not found in the list, - pspell_store_replacement can be used to store a - replacement pair and then pspell_save_wordlist to - save the wordlist along with the replacement pairs. The file should be - writable by whoever php runs as (e.g. nobody). Please, note that this - function will not work unless you have pspell .11.2 and aspell .32.5 or - later. + before calling pspell_new_config. The replacement + pairs improve the quality of the spellchecker. When a word is misspelled, + and a proper suggestion was not found in the list, + pspell_store_replacement can be used to store a + replacement pair and then pspell_save_wordlist to + save the wordlist along with the replacement pairs. The file should be + writable by whoever php runs as (e.g. nobody). Please, note that this + function will not work unless you have pspell .11.2 and aspell .32.5 or + later. @@ -419,7 +425,7 @@ pspell_check ($pspell_link, "thecat"); pspell_config_runtogether - Consider run-together words as valid compounds. + Consider run-together words as valid compounds Description @@ -432,13 +438,13 @@ pspell_check ($pspell_link, "thecat"); pspell_config_runtogether should be used on a config - before calling pspell_new_config. This function - determines whether run-together words will be treated 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. + before calling pspell_new_config. This function + determines whether run-together words will be treated 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. @@ -458,7 +464,7 @@ pspell_check ($pspell_link, "thecat"); pspell_config_save_repl Determine whether to save a replacement pairs list - along with the wordlist. + along with the wordlist Description @@ -471,14 +477,14 @@ pspell_check ($pspell_link, "thecat"); pspell_config_save_repl should be used on a config - before calling pspell_new_config. It determines - whether pspell_save_wordlist will save the - replacement pairs along with the wordlist. Usually there is no need to use - this function because if pspell_config_repl is used, - the replacement pairs will be saved by - pspell_save_wordlist anyway, and if it is not, - the replacement pairs will not be saved. Please, note that this function - will not work unless you have pspell .11.2 and aspell .32.5 or later. + before calling pspell_new_config. It determines + whether pspell_save_wordlist will save the + replacement pairs along with the wordlist. Usually there is no need to use + this function because if pspell_config_repl is used, + the replacement pairs will be saved by + pspell_save_wordlist anyway, and if it is not, + the replacement pairs will not be saved. Please, note that this function + will not work unless you have pspell .11.2 and aspell .32.5 or later. @@ -493,6 +499,7 @@ pspell_check ($pspell_link, "thecat"); int pspell_new + string language string @@ -549,35 +556,37 @@ pspell_check ($pspell_link, "thecat"); - PSPELL_FAST - Fast mode (least number of suggestions) + PSPELL_FAST - Fast mode (least number of + suggestions) - PSPELL_NORMAL - Normal mode (more suggestions) + PSPELL_NORMAL - Normal mode (more suggestions) - PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions) + PSPELL_BAD_SPELLERS - Slow mode (a lot of + suggestions) - PSPELL_RUN_TOGETHER - 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. + PSPELL_RUN_TOGETHER - 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. - Mode is a bitmask constructed from different constants listed - above. However, PSPELL_FAST, PSPELL_NORMAL and - PSPELL_BAD_SPELLERS are mutually exclusive, so you should select - only one of them. + Mode is a bitmask constructed from different constants listed above. + However, PSPELL_FAST, + PSPELL_NORMAL and + PSPELL_BAD_SPELLERS are mutually exclusive, so you + should select only one of them. For more information and examples, check out inline manual pspell @@ -599,7 +608,7 @@ $pspell_link = pspell_new ("en", "", "", "", pspell_new_config Load a new dictionary with settings based on a given config - + Description @@ -611,16 +620,16 @@ $pspell_link = pspell_new ("en", "", "", "", pspell_new_config opens up a new dictionary with - settings specified in a config, created with with - pspell_config_create and modified with - pspell_config_* functions. This method provides you - with the most flexibility and has all the functionality provided by - pspell_new and - pspell_new_personal. + settings specified in a config, created with with + pspell_config_create and modified with + pspell_config_* functions. This method provides you + with the most flexibility and has all the functionality provided by + pspell_new and + pspell_new_personal. The config parameter is the one returned by - pspell_config_create when the config was created. + pspell_config_create when the config was created. @@ -672,22 +681,22 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); pspell_new_personal opens up a new dictionary with - a personal wordlist and returns the dictionary link identifier for use - in other pspell functions. The wordlist can be modified and saved with - pspell_save_wordlist, if desired. However, the - replacement pairs are not saved. In order to save replacement pairs, you - should create a config using pspell_config_create, - set the personal wordlist file with - pspell_config_personal, - set the file for replacement pairs with - pspell_config_repl, and open a new dictionary with - pspell_new_config. + a personal wordlist and returns the dictionary link identifier for use + in other pspell functions. The wordlist can be modified and saved with + pspell_save_wordlist, if desired. However, the + replacement pairs are not saved. In order to save replacement pairs, you + should create a config using pspell_config_create, + set the personal wordlist file with + pspell_config_personal, + set the file for replacement pairs with + pspell_config_repl, and open a new dictionary with + pspell_new_config. The personal parameter specifies the file where words added to the - personal list will be stored. It should be an absolute filename - beginning with '/' because otherwise it will be relative to $HOME, - which is "/root" for most systems, and is probably not what you want. + personal list will be stored. It should be an absolute filename + beginning with '/' because otherwise it will be relative to $HOME, + which is "/root" for most systems, and is probably not what you want. The language parameter is the language code which consists of the @@ -717,35 +726,37 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); - PSPELL_FAST - Fast mode (least number of suggestions) + PSPELL_FAST - Fast mode (least number of + suggestions) - PSPELL_NORMAL - Normal mode (more suggestions) + PSPELL_NORMAL - Normal mode (more suggestions) - PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions) + PSPELL_BAD_SPELLERS - Slow mode (a lot of + suggestions) - PSPELL_RUN_TOGETHER - 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. + PSPELL_RUN_TOGETHER - 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. - Mode is a bitmask constructed from different constants listed - above. However, PSPELL_FAST, PSPELL_NORMAL and - PSPELL_BAD_SPELLERS are mutually exclusive, so you should select - only one of them. + Mode is a bitmask constructed from different constants listed above. + However, PSPELL_FAST, + PSPELL_NORMAL and + PSPELL_BAD_SPELLERS are mutually exclusive, so you + should select only one of them. For more information and examples, check out inline manual pspell @@ -756,7 +767,7 @@ $pspell_link = pspell_new_personal ($pspell_config, "en"); <function>pspell_new_personal</function> $pspell_link = pspell_new_personal ("/var/dictionaries/custom.pws", - "en", "", "", "", PSPELL_FAST|PSPELL_RUN_TOGETHER)); + "en", "", "", "", PSPELL_FAST|PSPELL_RUN_TOGETHER)); @@ -766,7 +777,7 @@ $pspell_link = pspell_new_personal ("/var/dictionaries/custom.pws", pspell_save_wordlist - Save the personal wordlist to a file. + Save the personal wordlist to a file Description @@ -778,12 +789,12 @@ $pspell_link = pspell_new_personal ("/var/dictionaries/custom.pws", pspell_save_wordlist saves the personal wordlist - from the current session. The dictionary has to be open with - pspell_new_personal, and the location of files to be - saved specified with pspell_config_personal and - (optionally) pspell_config_repl. Please, note that - this function will not work unless you have pspell .11.2 and aspell .32.5 - or later. + from the current session. The dictionary has to be open with + pspell_new_personal, and the location of files to be + saved specified with pspell_config_personal and + (optionally) pspell_config_repl. Please, note that + this function will not work unless you have pspell .11.2 and aspell .32.5 + or later. @@ -818,16 +829,16 @@ pspell_save_wordlist ($pspell_link); pspell_store_replacement stores a replacement pair for - a word, so that replacement can be returned by - pspell_suggest later. In order to be able to take - advantage of this function, you have to use - pspell_new_personal to open the dictionary. In order - to permanently save the replacement pair, you have to - use pspell_config_personal and - pspell_config_repl to set the path where to save your - custom wordlists, and then use pspell_save_wordlist - for the changes to be written to disk. Please, note that this function - will not work unless you have pspell .11.2 and aspell .32.5 or later. + a word, so that replacement can be returned by + pspell_suggest later. In order to be able to take + advantage of this function, you have to use + pspell_new_personal to open the dictionary. In order + to permanently save the replacement pair, you have to + use pspell_config_personal and + pspell_config_repl to set the path where to save your + custom wordlists, and then use pspell_save_wordlist + for the changes to be written to disk. Please, note that this function + will not work unless you have pspell .11.2 and aspell .32.5 or later. @@ -873,8 +884,8 @@ $pspell_link = pspell_new ("en"); 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>"; + foreach ($suggestions as $suggestion) { + echo "Possible spelling: $suggestion<br>"; } } @@ -900,4 +911,5 @@ sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: +vi: et:ts=1:sw=1:textwidth=78:syntax=sgml -->