NateGoSearchSpellChecker
└─NateGoSearchPSpellSpellChecker
public class NateGoSearchPSpellSpellChecker
extends NateGoSearchSpellChecker
| Constructor Summary | |
|---|---|
NateGoSearchPSpellSpellChecker(string language) Creates a new Pspell spell checker. |
|
| Method Summary | |
|---|---|
| void | addToPersonalWordList(string word) Add a word to the personal wordlist. |
| private string | getBestSuggestion(string misspelling, array suggestions) Gets the best suggestion of a misspelling from a list of suggestions. |
| private string | getLowerCaseSuggestion(array suggestions) Gets the best lower-case suggestion for a word. |
| array | getMisspellingsInPhrase(string phrase) Checks each word of a phrase for mispellings. |
| string | getProperSpelling(string phrase) Gets a phrase with all its misspelled words corrected. |
| private string | getSuggestedSpelling(string word) Checks to see if a word is spelled correctly and if it spelled incorrectly, suggests an alternative spelling. |
| void | Load the personal wordlist and replacement pairs into the spell checker. |
| void | setCustomReplacementPairs(mixed filename, string the) Set the replacement pairs. |
| void | setCustomWordList(string filename) Set the custom wordlist. |
| Methods inherited from NateGoSearch.NateGoSearchSpellChecker | |
|---|---|
| getMisspellingsInPhrase, getProperSpelling | |
public NateGoSearchPSpellSpellChecker(string language)
Creates a new Pspell spell checker
language - the language used by this spell checker. This should be a two-letter ISO 639 language code followed by an optional two digit ISO 3166 country code separated by a dash or underscore. For example, 'en', 'en-CA' and 'en_CA' are valid languages.public void addToPersonalWordList(string word)
Add a word to the personal wordlist
word - the word to add to the listprivate string getBestSuggestion(string misspelling, array suggestions)
Gets the best suggestion of a misspelling from a list of suggestions
misspelling - the misspelled word.suggestions - an array of suggestions.private string getLowerCaseSuggestion(array suggestions)
Gets the best lower-case suggestion for a word
suggestions - an array of suggestions.public array getMisspellingsInPhrase(string phrase)
Checks each word of a phrase for mispellings
phrase - the phrase to check.public string getProperSpelling(string phrase)
Gets a phrase with all its misspelled words corrected
phrase - the phrase to correct misspellings in.private string getSuggestedSpelling(string word)
Checks to see if a word is spelled correctly and if it spelled incorrectly, suggests an alternative spelling
Spell checking ignores case. The best suggestion is considered to be the first suggestion.
word - the word to check.public void loadCustomContent()
Load the personal wordlist and replacement pairs into the spell checker
public void setCustomReplacementPairs(mixed filename, string the)
Set the replacement pairs
Set the replacement pairs by passing the path to the custom word list.
the - path to the custom replacement pairspublic void setCustomWordList(string filename)
Set the custom wordlist
Set the custom word list by passing the path to the custom word list.
filename - the path to the custom word list
A spell checker to correct commonly misspelled words and phrases using the
pspellextension for PHP.This class uses the PHP interface to the GNU Aspell library for spell-checking.