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

Provides word lookup backed by primary and alternate Metaphone indexes, with a hook for lazy loading.

Definition

Namespace:Telerik.WinForms.Documents.Proofing

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class RadDictionary : IWordDictionary

Inheritance: objectRadDictionary

Derived Classes: RadEn_USDictionaryRadIsolatedStorageCustomDictionaryRadNonPersistentCustomDictionary

Implements: IWordDictionary

Constructors

Initializes an empty dictionary with default collection capacities.

C#
public RadDictionary()

Initializes an empty dictionary sized for an estimated number of entries.

C#
public RadDictionary(int expectedSize)
Parameters:expectedSizeint

The estimated number of words used to size the dictionary's collections.

Fields

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 indexed spellings.

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

Maps alternate Metaphone keys to their indexed spellings.

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

Properties

Gets whether the initial dictionary load has completed; the base class sets this after the load hook returns.

C#
protected bool DictionaryLoaded { get; }

Words

IEnumerable<string>

Gets the spellings contained in the dictionary.

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

Implements: IWordDictionary.Words

This property returns the currently indexed spellings without invoking the lazy-load hook.

Gets or sets the ordered word list used when loading and persisting dictionary contents.

C#
protected List<string> WordsList { get; set; }

Methods

Adds a spelling and its phonetic keys to the word and key indexes.

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

The spelling to index.

metaphonestring

The primary Metaphone key.

metaphoneAlternatestring

The alternate Metaphone key.

Determines whether the dictionary contains the specified spelling.

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

The spelling to look up.

Returns:

bool

true when the spelling is present; otherwise, false.

Implements: IWordDictionary.ContainsWord(string)

Ensures the derived dictionary data is initialized, invoking EnsureDictionaryLoadedOverride() only on the first call.

C#
protected void EnsureDictionaryLoaded()

Provides the derived dictionary's one-time initialization logic for EnsureDictionaryLoaded().

C#
protected virtual void EnsureDictionaryLoadedOverride()

Gets the primary Metaphone key recorded for a spelling.

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

The spelling whose phonetic key is requested.

Returns:

string

The primary phonetic key, or an empty string when no key is available. A dictionary without a phonetic index can return an empty string for words it contains.

Implements: IWordDictionary.GetMetaphoneKey(string)

Gets dictionary spellings that share a primary Metaphone key.

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

The primary Metaphone key to look up, not the original spelling.

Returns:

IEnumerable<string>

The matching spellings, or an empty sequence when the key is not present or the dictionary has no phonetic index.

Implements: IWordDictionary.GetWordsByMetaphoneKey(string)

Creates the word list and the lookup indexes used by this dictionary.

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

The estimated number of words used to size the collections.

Loads serialized entries into the word list and both phonetic indexes.

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

Entries in word:primaryKey:alternateKey form, as produced by the dictionary data format.

Loads dictionary entries from a stream. Blank lines are ignored; each other line must contain a spelling and its primary and alternate Metaphone keys separated by colons.

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

The stream containing serialized dictionary entries.

The reader created by this method is disposed when loading completes, which also closes stream.

Raises the DataChanged event.

C#
protected virtual void OnDataChanged()

Removes a spelling and its phonetic keys from the word and key indexes.

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

The spelling to remove.

metaphonestring

The primary Metaphone key previously associated with the spelling.

metaphoneAlternatestring

The alternate Metaphone key previously associated with the spelling.

Events

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

C#
public event EventHandler DataChanged