In version X10 of TX Text Control, we introduced language scopes that can be defined using the Selection.Culture property. Based on this specified language, the spell checking engine is using the appropriate dictionaries and hyphenation lists for spell checking, the suggestions and hyphenation.

In TX Text Control, a new dialog has been implemented that is used to define the language at the current input position or selection:

Sneak peek TX Spell 5.0: Language recognition engine

The tiny icons Spell icons in the dialog indicate that the dictionaries and hyphenation lists are available for that specific language.

Language scopes are exported by TX Text Control and MS Word automatically. But what if the document is coming from another source or if formats are loaded that doesn't have a language defined?

Version 5.0 of TX Spell .NET (for Windows Forms and WPF) will be released with a new feature: Language Detection.

Based on a very sophisticated algorithm, TX Spell .NET 5.0 is able to detect the used languages from out of more than 30 languages. Based on the detected languages, you can add the proper dictionaries to the dictionary collection or load the appropriate hyphenation lists.

The following screenshot shows a sample project that will be shipped with the installation package. The language scopes are colorized to visualize the various detected languages.

Sneak peek TX Spell 5.0: Language detection engine

Aside from the unbeatable performance and suggestion engine quality, a unique feature of TX Spell .NET is the adaptive spell checking for multilingual users. You can use several language and user dictionaries at the same time. This new functionality makes this unique feature complete.

High Performance Engine

The language detection engine requires a very low sampling size - it can detect the language from a single sentence with 4 or more words. It is not resource intensive, and returns the detected language(s) very fast. A typical document with 100 pages and 5 languages takes only less than 500 milliseconds on a PC with average specs.

The engine is based on the Unicode Bidirectional Algorithm (UBA) and its various levels to support documents that contain text from right-to-left as well as left-to-right in the same document.

Visual Studio Design Time Support

The detectable languages can be defined through the new property DetectableLanguageScopes with full design-time support in Visual Studio:

Sneak peek TX Spell 5.0: Language recognition engine

A collection editor can be used to add new languages to the DetectableLanguageScopes collection:

Sneak peek TX Spell 5.0: Language recognition engine

The following code sets the detectable languages to German and English in order to call the DetectLanguageScopes property with a multi-language text.

txSpellChecker1.DetectableLanguageScopes = 
        new CultureInfo[] { 
                new CultureInfo("de"),
                new CultureInfo("en"),
        };

txSpellChecker1.DetectLanguageScopes(
        "This is English text. Das ist ein deutscher Text.");

foreach (LanguageScope scope in txSpellChecker1.LanguageScopes)
{
        Console.WriteLine("Language: " + scope.Language +
                ", Start index: " + 
                scope.Start.ToString() +
                ", Length: " + 
                scope.Length.ToString());
}

The output of this code is:

Language: en, Start index: 0, Length: 21
Language: de, Start index: 21, Length: 28

This powerful feature of TX Spell .NET is another unique innovation of Text Control. Stay tuned for details of TX Spell .NET 5.0.