Dictionary and Language Examples
Dictionaries decide what TX Spell .NET for WPF accepts as correct: the Hunspell dictionaries of each language, and user dictionaries with the words your users add. The same language data serves hyphenation, synonyms and the detection of the language a text is written in. The samples and articles below show how an application loads and manages this data.
Samples of the Setup
The setup installs these samples in C# and Visual Basic, below TX Spell 11.0.NET for WPF\Samples\WPF in your Documents folder:
| Example | What it shows | Where |
|---|---|---|
| User dictionary | A UserDictionary created or loaded from a file; with IsEditable set to true, a list box shows its words while they are added and removed | UserDictionary |
| Hyphenation | A word typed in a text box, hyphenated with GetHyphenationPoints and the rules of a HyphenationList, such as the minimum number of characters at the beginning and the end of a word | Hyphenation |
No sample of the setup shows synonyms or language detection in a WPF application; the Web API below does both.
GitHub Samples
Two repositories on GitHub work with language data: the spell checking Web API creates synonyms with CreateSynonyms and detects the languages of a text with DetectLanguageScopes of the TXSpell class, and a Document Editor sample of TX Text Control .NET Server loads and saves user dictionaries stored on the server. GitHub Examples describes both and shows how to run them.
Blog Articles With Code
These articles contain their code, without a repository. They were written for TX Spell .NET for Windows Forms and for earlier versions, but the dictionary classes they use are the same in WPF; check the members in the reference:
| Example | What it shows | Where |
|---|---|---|
| An ignore list | A second user dictionary that users can't edit, used as a list of words to ignore | TX Spell .NET: Ignore Word List Using User Dictionaries |
| Dictionaries loaded on demand | The dictionary chosen by the culture at the input position and loaded from a shared location | Loading Dictionaries Dynamically in TX Spell .NET |
| Merged text in a user dictionary | The text of merged fields added to a temporary user dictionary, so that names from a database aren't marked as misspelled | Spell Checking, MailMerge and UserDictionaries |
| Dictionaries from embedded resources | An OpenOfficeDictionary created from the lines of a dictionary and affix file stored as resources in the assembly | TX Spell .NET 3.0: Loading Dictionaries from Embedded Resources |
| Hunspell dictionaries from OpenOffice | The .dic and .aff files taken from an OpenOffice extension | Using Hunspell Dictionaries from OpenOffice.org in TX Spell .NET |
Next Steps
- Dictionaries and Languages: Hunspell dictionaries, user dictionaries and language detection, explained.
- Hyphenation and Synonyms and Thesaurus: the other uses of the language data.
- Spell Checking Examples: the samples of spell checking itself.