Jump to content
Darian Miller

Spell Checker implementation?

Recommended Posts

What do you use for Spell Checking VCL apps on Windows made by Delphi?

 

There seems to be two commercial options left:

https://www.devexpress.com/products/vcl/spell_checker/

Included in their $1500 subscription. Don't think I want to pay $1500 for a spellchecker.

 

https://www.tmssoftware.com/site/tmsspellcheck.asp

Available alone or in their subscriptions.  I'm trying to get this to work now.

 

The old standby hasn't been updated since 2015 and forums are overrun by spam.   I assume these guys are no longer around?

http://www.addictivesoftware.com/

 

Share this post


Link to post

I did get a response out of Glenn Crouch @ AddictiveSoftware.   Apparently still pumping out manual updates for the latest Delphi release.

 

Share this post


Link to post

I've used the addictive lib for many years, but it's become a problem for me while separating execution from UI code so I can get by app running on docker - the library is so tied up in the vcl that it's not usable from a console app.   Sadly, it appears the devexpress and tms ones are also dependent on the vcl (layered api's people!)

  • Like 1

Share this post


Link to post
On 2/12/2020 at 10:04 AM, Darian Miller said:

 

Chris Rolliston's MPL source from Code Central is now on GitHub.  You can help make it as active as you like.  : )

 

https://github.com/darianmiller/Delphi-Hunspell

 

 

 

I put a few more items into this repo today:

- Alternative implementation from https://www.helpandmanual.com/downloads_delphi.html

- Newer Hunspell en_US dictionary from SCOWL (2019.10.06)

- Newer Win32 version of libhunspell.dll , built today from 2019.11.12 source, along with two small PDF docs.

 

 

I have a TFrame descendant that has the spell check functionality built-in, initially built for use with TMS components.  TMS has an ISpell based spell checker component that hooks into their TAdvMemo component.  It's pretty easy to replace their ISpell integration with a Hunspell integration using the CCR Hunspell unit.  There are a lot of recently updated dictionaries available for use with Hunspell.

 

ASpell as another option, with a lot of current dictionaries  and there's also a spell checker API in WIndows 8+ as mentioned on StackOverflow, but I haven't investigated this much..

 

 

SpellCheckPanel.png

SpellCheckPanel_carbon.png

Share this post


Link to post
Quote

Active Hunspell wrapper project would be cool. Jus saying... 🙂

Have a look at my NHunspell implementation (mentioned above as https://www.helpandmanual.com/downloads_delphi.html, but it's on SourceForge as well):

https://sourceforge.net/projects/nhunspelldelphi/files/

It is a wrapper for NHunspell for Delphi 2007 up to the latest versions. And it includes a wrapper class for Addict v4 dictionaries.

 

Hunspell is great, because it's open source and can use numerous dictionaries from OpenOffice. But Hunspell alone is missing a parser for the classes/controls used by many Delphi developers. Like a TRichview, just to name an example.

 

The Addict spell checker is great, because it is a solid spelling checker with a full-fledged parser, has been around for quite a while and it enjoys support for almost every Delphi control you can think of. Just the dictionaries delivered with Addict were never really good.

 

My goal back then was to combine the two, without having to rewrite everything spelling-check related. We keep using Addict as the spelling checker for everything it was used before. But we don't use the dictionaries. The component comes with an ad3MainDictionary.pas unit (which is, in fact, for Addict 4) and implements a new TMainDictionary (the Addict dictionary class), which redirects the generic functions to Hunspell. The unit needs to replace the original unit from Addict, or take precedence in your search path. The main dicts can be mixed with custom user-defined dictionaries from Addict and the spelling check function is fully transparent. The wrapper has been approved by Addictive Software for inclusion into the open source distribution, because this part of the package is actually not fully open.

 

What it does

  • Implements Hunspell for Delphi 2007 and up.
  • Takes .OXT files as dictionaries, no need to unzip them. A simple zip reader and XML parser is part of the distribution.
  • Supports spelling and hyphenation dictionaries (no Thesaurus)
  • Optionally introduces a TMainDictionary wrapper to use it with the Addict Spelling checker

So, if you have been using Addict (you need an Addict license, to use the Addict wrapper) you have the best of both worlds with this implementation. You can use Addict as your spell check engine without many changes, but run it with OpenOffice dictionaries. The hyphenation part is separate from Addict and needs to be applied manually. All the control parsers that were made for Addict, however, should be working fine.

 

I haven't bothered to update the component on SourceForge. It has received a few internal tweaks in last couple of years - mostly strange OXT configurations, that we have come across. If you are going to use it, please PM me for an update.

Edited by Alexander Halser
  • Like 1

Share this post


Link to post

Very helpful and quite complete list and details about spell check libraries by Darian, thanks for sharing!

 

I use the LS Spell Checker mentioned above in a project written in D7 (and contributed fixes back to Luzius the author in the past).

Now I need a unicode version (for D2009 and above).

I tried to modify it and it seems to be tricky since it mostly deals with character strings.

So I wonder, if anyone has a unicode version of it and can you share it with the rest of us?

And happy new year to every one in the forum!

Edited by Edwin Yip

Share this post


Link to post

So after:

  1. I failed to upgrade LS Speller to support Unicode Delphi,
  2. found that the TMS one from 2017 is not fast enough for me,
  3. none of the above mentioned Hunspell wrapper has a dialog which directly operates on TRichEdit/TMemo

In the end I found on Torry.net another hunspell wrapper originally written by Stefan Ascher, and have upgraded to support Unicode Delphi.

Check my new post if you are interested:

 

  • Like 1

Share this post


Link to post

Hi Team,

FWIW I had been wanting to add spell checking to my Apps for some time (years) but never got around to it.  😞

Based on the @Alexander Halser post above I bit the bullet and purchased Addict 4, gulp! - AU$490, perhaps I should have waited for the exchange rate to improve..nahh, I should live that long, and installed and integrated NHunspell.

Per his offer, Alexander was gracious enough to send me his current NHunspell files.  Thanks Alexander.

I contacted Glenn Crouch from ESBConsult and he sent me his current Addict4 files for D11.  Thanks Glenn.  They work for D10.4.2 as well.

After a short learning curve I now have spell checking operational in my Apps.  It was relatively painless.  🙂

My only question is about the currency of the actual dictionary .oxt files/data.

The dict-en.oxt file I have suggests it is from July 2010.  Is this still current or is there a more recent version?  Is there any value in sourcing a more recent file?  If so where from?

I'm figuring it doesn't really matter, dictionaries wouldn't change all that much and any new words can be added as part of Addict's interface.

 

Regards,

Ian

Share this post


Link to post

There were many options mentioned in this thread, but there was no mention of the most obvious one at least on Windows: the built-in Windows spellchecker available since Windows 8.  There many advantages compared to the options discussed here.

  • It is free.
  • Very easy to use.
  • Minimal code to add to your project.
  • No need to distribute dictionaries.  If the user wants a given language dictionary they can get it through Windows language settings.
  • It persists words added, ignored and autocorrected.
  • It detects duplicate words.

I got the idea from Ian Boyed's answer in this Stackoverflow question, but I could not find a Delphi translation of the Windows Spellcheck API.  So I created my own.   It is included in the attached zip file, along with a demo program.

 

image.thumb.png.71b6adb9e8eed0d12460dcad8ea8fdb4.png

SpellCheck.zip

Edited by pyscripter
  • Like 1
  • Thanks 5

Share this post


Link to post

Hi pyscripter,

Thanks for the thought.

Yes I was aware and I would have loved to use it, but regrettably my Users are still using Windows 7. :-(

Nevertheless, should they ever update, I won't hold my breath, or I have a need elsewhere with Windows 8 or better OS, I will certainly entertain/use it.

I have downloaded your SpellCheck.zip file.  Thank you.

Regards,

Ian

Share this post


Link to post

Hi pyscripter,
Thanks it's working great.
Will use this solution in my interfaces.
Regards,
Ben

Edited by Benoit

Share this post


Link to post

Hello psyscripter,

thank you very much for your SpellCheck.zip. It works great. Unfortunately I do not understand how to load the dictionaries. Can you give me an example for IUserDictionariesRegistrar?
Thanks a lot
Chris

Share this post


Link to post

Dictionaries are downloaded via Windows Language preferences.  You just select the language as in the demo.

Share this post


Link to post

Thank you pyscripter, my problem was to get an instance of the interface. Now it works.

 

SpellFactory.QueryInterface(IID_IUserDictionariesRegistrar, UserDictionariesRegistrar);

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×