Initializes a new instance of the Speller class without specifying a dictionary file.
Namespace: Karamasoft.WebControls.UltimateSpell
Assembly: UltimateSpell (in UltimateSpell.dll) Version: 3.7.4186.26738
Syntax
C# |
---|
public Speller() |
Visual Basic |
---|
Public Sub New |
Visual C++ |
---|
public: Speller() |
Examples
This sample shows how to instantiate this class without specifying a physical path to the dictionary file.
CopyC#
// Create array lists for spell errors ArrayList spellErrors = new ArrayList(); StringBuilder sbSpellErrors = new StringBuilder(); // Create spell checker Speller speller = new Speller(); // Check whether dictionary is in cache if (!speller.DictionaryInCache("your dictionary file")) { // Get words from your own dictionary source DataTable dt = GetWords("your dictionary file"); foreach (DataRow dr in dt.Rows) { string word = dr[0].ToString(); speller.AddWord(word); } // Write dictionary into cache speller.CacheDictionary("your dictionary file"); } // Call spell check spellErrors = speller.SpellCheck("text to spell check"); // Create a string in the form of misspelledWord,textIndex,type,suggestion1,suggestion2,...|misspelledWord,textIndex,type,suggestion1,suggestion2,... foreach (SpellError spellError in spellErrors) { sbSpellErrors.Append(spellError.MisspelledWord); sbSpellErrors.Append(","); sbSpellErrors.Append(spellError.TextIndex); sbSpellErrors.Append(","); sbSpellErrors.Append(Convert.ToInt32(spellError.Type).ToString()); foreach (string suggestion in spellError.Suggestions) { sbSpellErrors.Append(","); sbSpellErrors.Append(suggestion); } sbSpellErrors.Append("|"); } sbSpellErrors.Remove(sbSpellErrors.Length - 1, 1);