Speller Constructor (String)

UltimateSpell

Collapse image Expand Image Copy image CopyHover image
Initializes a new instance of the Speller class by specifying a dictionary file.

Namespace: Karamasoft.WebControls.UltimateSpell
Assembly: UltimateSpell (in UltimateSpell.dll) Version: 3.7.4186.26738

Syntax

C#
public Speller(
	string dictionaryFile
)
Visual Basic
Public Sub New ( _
	dictionaryFile As String _
)
Visual C++
public:
Speller(
	String^ dictionaryFile
)

Parameters

dictionaryFile
Type: System..::..String
Physical path to the dictionary file.

Examples

This sample shows how to instantiate this class by 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(@"C:\Inetpub\wwwroot\WebApplication1\UltimateSpellInclude\Dictionary\en-US\en-US.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