Class SpellChecker
The spell checker
Inheritance
Implements
Namespace: Syncfusion.EJ2.SpellChecker
Assembly: Syncfusion.EJ2.SpellChecker.dll
Syntax
public class SpellChecker : Object, ISerializable
Constructors
SpellChecker()
Initializes a new instance of the SpellChecker class.
Declaration
public SpellChecker()
SpellChecker(List<DictionaryData>, String)
Initializes a new instance of the SpellChecker class using DictionaryData.
Declaration
public SpellChecker(List<DictionaryData> dictItem, string customDicPath)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<DictionaryData> | dictItem | Collection of DictionaryData objects. |
System.String | customDicPath | Custom dictionary path. |
SpellChecker(List<SpellCheckDictionary>)
Initializes a new instance of the SpellChecker class.
Declaration
public SpellChecker(List<SpellCheckDictionary> dictItem)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SpellCheckDictionary> | dictItem | The spell check dictionary collection |
SpellChecker(SerializationInfo, StreamingContext)
Initializes a new instance of the SpellChecker class.
Declaration
protected SpellChecker(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | The System.Runtime.Serialization.SerializationInfo to populate with data. |
System.Runtime.Serialization.StreamingContext | context | The destination (see System.Runtime.Serialization.StreamingContext) for this serialization. |
Methods
AddNewWord(String, String, String, String[])
Adds the specified new root word to the dictionary along with the rule to form the possible words.
Declaration
public void AddNewWord(string dicPath, string affPath, string rootWord, string[] possibleWords)
Parameters
Type | Name | Description |
---|---|---|
System.String | dicPath | The dictionary file path. |
System.String | affPath | The affix file path. |
System.String | rootWord | The new root word to be added. |
System.String[] | possibleWords | The possible words that can be formed from the root word. |
Remarks
The rules are framed automatically using the root word, the possible words and affix file.
If you pass null for the parameters affPath and possibleWords, then it will add a single root word to dictionary.
Examples
The following code example demonstrates how to add a new root word to the dictionary along with the rule to form the possible words.
// Adds the specified new root word to the dictionary along with the rule to form the possible words.
spellchecker.AddNewWord("en.dic","en.aff", "construct", new string[] { "constructs", "reconstruct", "constructed", "constructive" });
CheckSpelling(Int32, String)
Method to check spelling for the text or page content.
Declaration
public void CheckSpelling(int languageID, string textToCheck)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | languageID | the language ID |
System.String | textToCheck | Text/Page content to be spell checked |
GetObjectData(SerializationInfo, StreamingContext)
Retrieves serialized informaion
Declaration
protected virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | the info |
System.Runtime.Serialization.StreamingContext | context | the context |
GetSuggestions(Int32, String, Boolean, Boolean, Boolean)
Method to retrieve spelling error and suggestion for the given word
Declaration
public void GetSuggestions(int languageID, string data, bool checkSpelling, bool checkSuggestion, bool addWord)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | languageID | the Language ID |
System.String | data | the data |
System.Boolean | checkSpelling | check spelling |
System.Boolean | checkSuggestion | check suggestion |
System.Boolean | addWord | add word |
InitializeDictionaries(List<DictionaryData>, String, Int32)
Initialize the spell checker dictionaries required for SpellChecker class.
Declaration
public static void InitializeDictionaries(List<DictionaryData> dictionaryColl, string customDicPath, int dictionaryCacheLimit)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<DictionaryData> | dictionaryColl | Collection of DictionaryData objects. |
System.String | customDicPath | Custom dictionary path to save custom words. |
System.Int32 | dictionaryCacheLimit | Active number of spell check dictionary instances. |