Key Methods
didYouMean( $text )
- Suggests the most likely correctly spelled string to the string $input.
- arguments: (string) $text
- returns (string)
SpellCheckWord ($word)
Suggestions( $word )
- Returns spelling suggestions for (string) $word.
-
Suggestions are listed in probability order - most probable coming first.
- arguments: (string) $word
- returns (array) of strings
ErrorTypeWord( $word )
- Returns a (char) that explains why $word is not a valid word.
-
- "E" - Enforced Correction
- "B" - Word is on your banned words list
- "C" - A CaSe Mistake
- "X" - (infrequent) Unlicensed software
- "S" - Spelling mistake. Not found in any dictionary and none of the above cases apply.
- "" -$word is valid
- arguments: (string) $word
- returns (char)
LoadDictionary( $dictionaryName )
- Loads a Dictionary into the spellchecker.
- The (string) $dictionaryName rerers to a file with a .dic file extension in your
DictionaryPath directory.
- E.G. LoadDictionary("English (international)") will load file: /phpspellcheck/dictionaries/English (international).dic
- arguments: (string) $dictionaryName
- returns null
ListDictionaries
- Return an array of strings that relate to dictionaries that have been loaded.
- Also see LoadDictionary
- arguments: none
- returns (array) of strings
ListLiveDictionaries()
- Return an array of strings that relate to dictionaryNames of all installed DictionaryPath.
- Also see LoadDictionary
- returns (array) of dictionary names as strings.
SetContext($tokens)
- Allows the spell checker to see $tokens - the whole document context it is spellchecking in.
- This allows the spell-checker to use statistics on word usage to increase spelling suggestion accuracy.
- arguments: (array) $tokens is as a tokenized array of strings - which can be generated by must be set by the tokenizeString method.
LoadCommonTypos($filePath)
- Loads a list of common typographic mistakes from a file relative to your DictionaryPath directory.
- Aids spell-checker suggestion accuracy.
- Example of such a file can be found at /phpspellcheck/dictionaries/langauge-rule/common-mistakes.txt
- arguments: (string) $filePath
- returns: null
herat-->heart
hewas-->he was
hismelf-->himself
...
BuildCommonTypos($arrayOfCommonTypos)
- Adds to a list of common typographic mistakes from an array which can be programmed or drawn from a database
- Aids spell-checker suggestion accuracy.
- arguments: (array) $arrayOfCommonTypos
- returns: null
heart","hewas-->he was","hismelf-->himself"))
LoadEnforcedCorrections( $filePath )
- Loads a list of Enforced Corrections from a file.
- The (string) $filePath refers to a file within your DictionaryPath directory
- Example of such a file can be found at /phpspellcheck/dictionaries/langauge-rule/enforced-corrections.txt
- arguments: (string) $filePath
- returns: null
USA--> United States Of America || United States Army
LoadCustomBannedWords( $filePath )
- Loads a list of Banned Words from a text file, 1 word per line.
- A banned word can never spellcheck true.
- The (string) $filePath refers to a file within your DictionaryPath directory.
- Example of such a file can be found at /phpspellcheck/dictionaries/langauge-rule/banned-words.txt
- arguments: (string) $filePath
- returns: null
AddBannedWords($arrayOfBannedWords)
- Adds a list of Banned Words from an array of strings.
- $arrayOfBannedWords array can easily be populated from an SQL query.
- A banned word can never spellcheck true.
- arguments: (array) $arrayOfBannedWords
- returns: null
LoadCustomDictionary( $filePath )
- Loads additional vocabulary into the spell-checker from a file in the DictionaryPath directory.
- This document must return a document with 1 word on each line.
- Performance will be increased if the words are structured in ascending ascii sort order.
- An example of such a file can be found at /phpspellcheck/dictionaries/custom.txt
- arguments: (string) $filePath
- returns: null
AddCustomDictionaryFromArray($arrayOfWords)
- Loads additional vocabulary into the spell-checker from an array of words.
- arguments: (array) $arrayOfWords
- returns: null
LoadCustomDictionaryFromURL($url)
- Loads vocabulary into the spell-checker from a URL. The url may be remote or local.
- $url should be fully formed - starting with http://
- This URL must render a document with 1 word on each line.
- Performance will be increased if the words are structured in ascending ascii sort order.
- arguments: (string) $url
- returns: null