Spell checker engine, checks a text string for spelling errors and makes suggested corrections.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public class RapidSpellChecker : ICheckerEngine
Public Class RapidSpellChecker _ Implements ICheckerEngine
public ref class RapidSpellChecker : ICheckerEngine
Members
All Members | Constructors | Methods | Properties | Fields | Events |
Icon | Member | Description |
---|---|---|
RapidSpellChecker()()() | Throws a licensing exception! Please use .ctor with license key. | |
RapidSpellChecker(String) | Creates a RapidSpellChecker, with no user dictionary. | |
AddIgnorePattern(String) | Adds a regex pattern to ignore (maximum of 20 can be added - IgnoreURLsAndEmailAddresses=true counts as 1). | |
AddWord(String) | Adds word to the user dictionary (if it has been specified). | |
AllowAnyCase | Whether to allow words spelt with incorrect case, eg. "africa", instead of "Africa", this is more relaxed than AllowMixedCase | |
AllowMixedCase | Whether to allow words spelt with mixed case, eg. "MIxEd" - also see AllowAnyCase. | |
ChangeAll(String) | Changes all instances of the current bad word to newWord in the text. | |
ChangeBadWord(String) | Changes the current bad word to newWord in the text. | |
ChangeBadWord(BadWord, String) | Changes badWord to newWord in the text. | |
ChangeWord | Change word event, fired when a word is changed. | |
Check(String) | Checks text for spelling correctness, from beginning of text, mis-spelt words can be accessed through nextBadWord. | |
Check(String, Int32) | Checks text for spelling correctness, from startPosition in text, mis-spelt words can be accessed through NextBadWord. | |
CheckCompoundWords | Whether to check for compound words, setting this to true is essential for languages such as German which
allow for compound words. | |
convertHtmlEntities(String) | Converts HTML entity codes to their Unicode characters | |
convertHtmlEntities(String, Boolean) | Converts HTML entity codes to their Unicode characters | |
CurrentBadWord | Gets the current bad word (last returned by NextBadWord). | |
DictFilePath | The file to be used as the main dictionary, if this is null then the RapidSpellMDict.DLL satellite assembly is used. | |
Dispose(Boolean) |
Disposes of resources.
| |
Dispose()()() |
Clean up any resources being used.
| |
dontSuggest | Don't suggest words in this array (swear words). | |
Equals(Object) | (Inherited from Object.) | |
Finalize()()() |
Frees up resources.
(Overrides Object.Finalize()()().) | |
FindAnagrams(String, IList) | Finds anagrams of word and puts them in anagrams if not already present. | |
FindCapitalizedSuggestions | Whether to look for capitalized suggestions, note this will slow FindSuggestions down by about 7 times. | |
FindCompoundWords(String, IList) | Finds the compound words in text and puts them in subwords, set subwords to null/nothing to just find if text has compound word formation. | |
FindSuggestions()()() | Gets an enumeration of String suggestions for spelling of current bad word. | |
FindSuggestions(String) | Gets an enumeration of String suggestions for word. | |
FindSuggestions(String, Boolean) | Gets an enumeration of String suggestions for word. | |
GetAmendedText()()() | Returns the original text sent to check() but with any alterations made through change | |
GetConsiderationRange()()() | Gets the factor for words to consider for suggestions.
| |
GetHashCode()()() |
Serves as a hash function for a particular type.
(Inherited from Object.) | |
GetIgnoreCapitalizedWords()()() | Gets whether to ignore words with capital letters. | |
GetIncludeUserDictionaryInSuggestions()()() | Gets whether the user dictionary should be used in finding suggestions for misspelt words. | |
GetNextWord()()() | Returns the next word in the text. | |
GetSeparateHyphenWords()()() | Gets whether to treat hyphenated (-) words as separate words, default is false. | |
GetSuggestionsMethod()()() | Gets the suggestions method to use. Either PHONETIC_SUGGESTIONS or HASHING_SUGGESTIONS
| |
GetType()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
GetUndoableStatePoint()()() |
Gets the state of the current run, which can be stored and used with RevertToUndoableStatePoint(RapidSpellChecker..::.State) | |
HASHING_SUGGESTIONS | Indicator for suggestion method (Hashing is default). | |
IgnoreAll(String) | Marks word to be ignored in rest of the text. | |
IgnoreList | The words to ignore, note this list is changed by IgnoreAll. | |
IgnoreRtfCodes | Sets whether this should ignore Rtf (or any escaped) codes in the text. | |
IgnoreURLsAndEmailAddresses | Whether to ignore URLs and email addresses (requires V2Parser=true) | |
IgnoreWordsWithDigits | Whether to ignore words with numbers in them (eg. A10 or 7-11). | |
IgnoreXML | Whether to ignore XML/HTML tags, should be set true for RichTextBox support, false by default. | |
IsAllCaps(String) |
Whether all chars in s are in upper case
| |
IsStartsWithCap(String) |
Whether first letter is a capital and rest are lower.
| |
IsWord(Int32, Int32) |
Whether the word defined by the parameters is a word or whitespace.
| |
LanguageParser | The type of language parsing to use. | |
LicenseKey | The license key | |
LookIntoHyphenatedText | Whether to 'look into' text with hyphens (-), if the word has hyphens in it and
LookIntoHyphenatedText is set true (default), the parts of the text around the hyphens will be checked individually. | |
LookUp(String) | Checks if query is in the main dictionary or user. | |
LookUpMainDictionary(String) | Checks if query is in the word dictionary. Returns true if doesnt start with a letter or apostrophe | |
LookUpUserDictionary(String) | Look up the query in the user dictionary if it exists. | |
Main(array<String>[]()[]) | For test purposes | |
MakeCap(String) | Capitalises first letter of word | |
MemberwiseClone()()() |
Creates a shallow copy of the current Object.
(Inherited from Object.) | |
NextBadWord()()() | Returns the next mis-spelt word in the text, as a BadWord object. | |
PHONETIC_SUGGESTIONS | Indicator for suggestion method (Hashing is default). | |
ReloadUserDictionary()()() |
Reloads the user dictionary.
| |
RemoveIgnorePattern(String) | Removes a regex pattern to ignore (maximum of 20 can be added - IgnoreURLsAndEmailAddresses=true counts as 1). | |
RevertToUndoableStatePoint(RapidSpellChecker..::.State) |
Reverts the state to what it was when GetUndoableStatePoint()()() was called.
| |
SetConsiderationRange(Int32) | Sets the factor for words to consider for suggestions,
lower values are faster but consider less words for suggestions. Default is 80.
If w <= 1 this method won't do anything.
| |
SetDictFileStream(Stream) | Passes a Dict file as a stream, to be used for the main dictionary. | |
SetIgnoreCapitalizedWords(Boolean) | Sets whether to ignore words with capital letters. | |
SetIncludeUserDictionaryInSuggestions(Boolean) | Sets whether the user dictionary should be used in finding suggestions for misspelt words. | |
SetOptionalContext(String, String) |
Provides the engine with any helpful text around the text snippet which will be passed to the Check method.
| |
SetPosition(Int32) | Sets the pointer position for the NextBadWord iterator. | |
SetSeparateHyphenWords(Boolean) | Sets whether to treat hyphenated (-) words as separate words, default is false. | |
SetSuggestionsMethod(Int32) | Sets the suggestions method to use. Either PHONETIC_SUGGESTIONS or HASHING_SUGGESTIONS
| |
SetUserDictionary(String) | Set the user dictionary to use. | |
SetUserDictionary(UserDictionary) | Set the user dictionary to use. | |
ShareDictionary | Whether to share the dictionary in memory accross all instances of RapidSpellChecker (false by default).
| |
SuggestSplitWords | Whether to look for connected words in suggestions. | |
TextBoundary | The AdvancedTextBoundary class to use to parse words. | |
theText | The text being checked. | |
ToString()()() | (Inherited from Object.) | |
userDictionary | The UserDictionary being used, may be null if no user dictionary is being used. | |
V2Parser | Whether to use parser version 2 - Set to false for backwards compatibility. | |
WarnDuplicates | Whether to treat duplicate words as errors (eg. "this is is an error"). | |
WordAdded | Fired when word added to user dictionary | |
wordEnd | The end index of the current word being checked/parsed. | |
WordIgnored | Fired when word ignored | |
wordStart | The start index of the current word being checked/parsed. |
Remarks
This is a non-GUI component, suitable for the business/logic layer of your application.
You would use this component in web server based applications.
This component can be used in 2 different ways. The most common usage, in an iterative fashion is detailed below, but
it may also be used on a query by query basis.
To use this component in an iterative way you must first call Check to set the text to check and
then iterate through
NextBadWord() to identify misspelt words. NextBadWord will return
a BadWord object and internally locate the
the misspelt word in the text, then you can call FindSuggestions
which will return a ArrayList of suggestions as String objects. You may also call ChangeBadWord(replacement)
to replace that current misspelt word in the text.
NextBadWord() will return null when the text has been checked. GetAmendedText returns the current
state of the text with corrections.
Calling ChangeBadWord or FindSuggestions before NextBadWord has been called
and returned a BadWord (i.e. not null) will result in a NoCurrentBadWordException.
Remarks
The second way to use this component is simply to query words yourself using LookUp(word) to check if word is in the lexicon/dictionary and FindSuggestions(word) to find spelling suggestions for word.
Examples
Check some text, find suggestions and replace mis-spelt words with "replacement".
CopyC#
RapidSpellChecker c = new RapidSpellChecker(); BadWord badWord; ArrayList suggestions; //check some text. c.Check("This is sume text."); //iterate through all bad words in the text. while((badWord = c.NextBadWord())!=null){ Console.WriteLine(badWord.GetWord() + "- is not spelt correctly. Suggestions:"); try{ //get suggestions for the current bad word. suggestions = c.FindSuggestions(); //display all suggestions. for(int i=0; i<suggestions.Count; i++){ Console.WriteLine(suggestions[i]); } //change the bad word in the text with "replacement". c.ChangeBadWord("replacement"); } catch (NoCurrentBadWordException e){ Console.WriteLine(e); } } Console.WriteLine(c.GetAmendedText());
Inheritance Hierarchy
Object | |
RapidSpellChecker |