New to Telerik UI for WinForms? Start a free 30-day trial

Stores dictionary spellings and indexes them by primary and alternate Metaphone keys.

Definition

Namespace:Telerik.WinControls.SpellChecker.Proofing

Assembly:Telerik.WinControls.SpellChecker.dll

Syntax:

C#
public class WordDictionary : IWordDictionary

Inheritance: objectWordDictionary

Derived Classes: EnglishDictionaryRadIsolatedStorageCustomDictionaryRadNonPersistentCustomDictionary

Implements: IWordDictionary

Constructors

Creates an empty dictionary using the default initial capacities.

C#
public WordDictionary()

Creates an empty dictionary with capacity sized for the expected number of words.

C#
public WordDictionary(int expectedSize)
Parameters:expectedSizeint

The anticipated number of dictionary entries.

Fields

Stores loaded spellings in the order their entries are processed.

C#
protected List<string> allWords

Shared empty result returned when a phonetic lookup has no matches.

C#
protected static readonly string[] emptyStringArray

Maps each spelling to its primary and alternate Metaphone keys.

C#
protected Dictionary<string, Tuple<string, string>> metaphoneByWord

wordsByMetaphone

Dictionary<string, List<string>>

Maps primary Metaphone keys to their dictionary spellings.

C#
protected Dictionary<string, List<string>> wordsByMetaphone

Maps alternate Metaphone keys to their dictionary spellings.

C#
protected Dictionary<string, List<string>> wordsByMetaphoneAlternate

Properties

Indicates whether the dictionary's lazy-load hook has completed.

C#
protected bool DictionaryLoaded { get; }

Words

IEnumerable<string>

Enumerates the spellings currently in the dictionary indexes. Accessing this property does not trigger lazy loading.

C#
public IEnumerable<string> Words { get; }

Implements: IWordDictionary.Words

Methods

Adds a spelling to both phonetic indexes and records its keys in the word map.

C#
protected void AddWordToMetaphoneDictionaries(string word, string metaphone, string metaphoneAlternate)
Parameters:wordstring

The spelling to index.

metaphonestring

The primary Metaphone key for the spelling.

metaphoneAlternatestring

The alternate Metaphone key for the spelling.

Determines whether the dictionary contains the exact spelling.

C#
public bool ContainsWord(string word)
Parameters:wordstring

The spelling to look up.

Returns:

bool

true if the spelling is present; otherwise, false.

Implements: IWordDictionary.ContainsWord(string)

Loads the dictionary once, invoking the subclass hook while holding a synchronization lock.

C#
protected void EnsureDictionaryLoaded()

Loads entries for a concrete dictionary type. Override this method to populate the indexes on first lookup.

C#
protected virtual void EnsureDictionaryLoadedOverride()

Gets the primary Metaphone key stored for a spelling.

C#
public string GetMetaphoneKey(string word)
Parameters:wordstring

The spelling whose key is requested.

Returns:

string

The primary key, or an empty string when the spelling is not present.

Implements: IWordDictionary.GetMetaphoneKey(string)

Gets dictionary spellings indexed by the specified primary Metaphone key.

C#
public IEnumerable<string> GetWordsByMetaphoneKey(string word)
Parameters:wordstring

The primary Metaphone key to look up.

Returns:

IEnumerable<string>

The matching spellings, or an empty sequence when the key has no matches.

Implements: IWordDictionary.GetWordsByMetaphoneKey(string)

Initializes the word storage and phonetic indexes.

C#
protected void Init(int expectedSize)
Parameters:expectedSizeint

The anticipated number of dictionary entries.

Loads colon-delimited entries containing a spelling, its primary Metaphone key, and its alternate key.

C#
protected void Load(IEnumerable<string> entries)
Parameters:entriesIEnumerable<string>

The dictionary records to index.

Loads colon-delimited dictionary records from a stream and indexes their spelling and Metaphone keys.

C#
public void Load(Stream stream)
Parameters:streamStream

A text stream containing one dictionary record per line.

The stream is closed when this method finishes reading it.

Raises DataChanged for changes made by a dictionary implementation.

C#
protected virtual void OnDataChanged()

Removes a spelling from both phonetic indexes and the word-to-key map.

C#
protected void RemoveWordFromMetaphoneDictionaries(string word, string metaphone, string metaphoneAlternate)
Parameters:wordstring

The spelling to remove.

metaphonestring

The primary Metaphone key associated with the spelling.

metaphoneAlternatestring

The alternate Metaphone key associated with the spelling.

Events

Occurs when a dictionary implementation signals that its contents have changed.

C#
public event EventHandler DataChanged