UltimateSpell Class Library

Speller Constructor (String, String)

Initializes a new instance of the Speller class by specifying a dictionary file.

[Visual Basic]
Overloads Public Sub New( _
   ByVal dictionaryFile As String, _
   ByVal customDictionaryFile As String _
)
[C#]
public Speller(
   string dictionaryFile,
   string customDictionaryFile
);

Parameters

dictionaryFile
Physical path to the dictionary file.
customDictionaryFile
Physical path to the custom dictionary file.

Example

This sample shows how to instantiate this class by specifying a physical path to the dictionary file.

  // Create array lists for spell errors
  ArrayList spellErrors = new ArrayList();
  StringBuilder sbSpellErrors = new StringBuilder();
  
  // Create spell checker
  Speller speller = new Speller(@"C:\Inetpub\wwwroot\WebApplication1\UltimateSpellInclude\Dictionary\en-US\en-US.dic", @"C:\Inetpub\wwwroot\WebApplication1\UltimateSpellInclude\CustomDictionary\CustomEnglish.dic");
  
  // 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);

See Also

Speller Class | Karamasoft.WebControls.UltimateSpell Namespace | Speller Constructor Overload List