revUp - Updates and news for the LiveCode community
Issue 145 | December 7th 2012 Contact the Editor | How to Contribute

Planet Spell
By Scott McDonald

RunRevPlanet Spell has reached version 2.5. First released in 2009 as SpellCheck and then later as Spell 2.0, RunRevPlanet Spell is an ideal cross-platform spell checking library for LiveCode. Using the naturally fast string processing and associative arrays of LiveCode to check up to 25,000 words per second without an external, RunRevPlanet Spell is 100% LiveCode and supports desktop and mobile platforms.

This new upgrade to RRP Spell adds significant new features.

Unicode Support

RRP Spell 2.5 now supports dictionaries using Unicode character sets. Removing the previous limitation of only allowing dictionaries with an 8 bit character set allows RRP Spell to be used in a wider variety of applications.

Not only does the Unicode support work with the current LiveCode version of 5.5, but also with older versions. So if you have a project that you want to keep working with version 5.0.2 of the LiveCode engine you can. Provided you are using LiveCode 4.6.3 or newer you can do spell checking with a 16 bit UCS.

Unrestricted Number of Dictionaries

In addition to the supplied AU, UK and US dictionaries, the previous RRP Spell was limited to only 4 more different dictionaries. Now the command:

rrpSpellAddDictionary 

removes that restriction so you can add as many dictionaries as you need. The command rrpSpellCreateDictionaryFromFile creates a dictionary file from a list of words so it can be added to RRP Spell. The list must be a text file with the dictionary words, one word per line. The text file can be either ANSI text, or Unicode text that is encoded as either UTF-8 or UTF-16.

With RRP Spell 2.5, if you can source a suitable word list in any language, you can convert it to a dictionary. Unfortunately, while I consider myself knowledgeable in computing languages, languages other than English are not an area of expertise here at RunRevPlanet. This and licensing considerations means that RunRevPlanet does not supply any non-English language dictionaries. Depending on your skills and the type of software you are making you may already have a suitable word list, or be able to source one from the Internet.

Here is an example of the beginning of a Unicode file that is suitable for converting to a RRP Spell 2.5 dictionary.

russian unicode mixedcase
аббревиатура
абла
абляционная
абляционной
абляционную
аборигенов
абрамовича

The first line (the header) of a dictionary with Unicode characters must include the unicode tag and if the dictionary has an alphabet with upper and lower case characters, the mixedcase tag. A Unicode dictionary works best with an extra tag that specifies the language used in the contextual menu. In this example, the tag is russian and helps with the appearance of the contextual menu when doing a modeless spell check in versions of LiveCode earlier than 5.5.

Red dotted underline

LiveCode 5.5 introduced the flagged chunk property for text in a field. As the Release Notes for LiveCode 5.5 say:

"Runs of characters that have this property set to true will be underlined with a dotted red line, flagging them as potentially needing attention. The purpose of this property is to allow easier implementation of on-demand spell-checking in fields."

This feature is exactly what users of RRP Spell have been asking for, so with RRP Spell 2.5 and the LiveCode 5.5 engine, put this line in your code:

rrpSpellSetFlaggedErrors true 

and keep your users satisfied by giving your application a standard look when spell checking.

Switch Between Custom Dictionaries

Another addition to RRP Spell 2.5 is easy switching of the custom dictionary. RRP Spell has the main dictionary which is either AU UK, US, or any another language you have added yourself. The main dictionary is the core of the language you are checking. In some applications you need a supplemental dictionary to add to this, which may also change depending on the context of the application. To allow this the new:

rrpSpellSetCustomDictionaryFromFile 

command loads a custom dictionary at runtime, and allows you to change it while your application is running. In the previous RRP Spell 2.0 the custom dictionary was fixed during initialization and could not be changed.

Documentation

As with all software from RunRevPlanet, we actually enjoy documenting our libraries, so RRP Spell includes a complete 78 page Guide & Reference that documents these new features and the 60 handlers available to you in the API. Here is the table of contents from the manual.

Chapter Page
Introduction 3
Installation & Requirements 5
Conventions 6
Licensing Agreement 7
Using RRP Spell 2.5 9
Coding a Spell Checker 11
Modeless Spell Check Demo 13
Modal Spell Check Demo 17
iOS Spell Demo 22
Android Spell Demo 26
Planet Spell Demo 28
Customising the Modal Dialog 29
Creating Dictionaries and Unicode 31
Spell Messages 35
Deploying Your Own Application 38
Error Messages 41
Upgrading from RRP SpellCheck 43
Handler Reference 49

At RunRevPlanet, a LiveCode library is not complete until it is fully documented, and if you would like to examine the documentation it is available here. RunRevPlanet Spell 2.5 is available from the RunRev Store.

About the Author

Scott McDonald is the owner of Scott McDonald PC Services, providing software to teachers worldwide. Scott also manages RunRevPlanet which produces cross-platform libraries and controls for LiveCode developers. Visit RunRevPlanet here.

 

Main Menu

What's New


Buy DVDs plus Simulcast 70% off