Recent

Author Topic: "ASpell" spell checker  (Read 577 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 385
"ASpell" spell checker
« on: January 20, 2021, 01:18:57 am »
Thaddy was helping me in a separate thread, where he states:

Quote
Suggest to do what Avra suggests: use hunspell instead. That makes it also cross platform.
FPC comes also with ASpell in the default packages in the distribution. That is also cross platform.
There are already FPC sources and demo's for both.

I found the source files, but have no idea where to find the demos on how to use ASpell to check the spelling of words in a TMemo for example.  I need help with that.

I am still struggling with hunspell.  I found the demo project, but it it refuses to load the dictionaries, even though they exist and the full pathname is being provided.  I'll keep working on hunspell while waiting for an answer to this post.
« Last Edit: January 20, 2021, 08:32:49 pm by RedOctober »

bobonwhidbey

  • Sr. Member
  • ****
  • Posts: 473
    • Double Dummy Solver - free download
Re: "ASpell" spell checker
« Reply #1 on: January 20, 2021, 07:25:34 pm »
I too am trying to get hunspell working. I've put the .dic file in the same folder as my test project. Like yourself, the FindLibrary() procedure fails. I am using 32-bit version of Laz on Win10.

Code: Pascal  [Select][+][-]
  1. var
  2.   Dic: THunspell;
  3. begin
  4.   Dic := THunSpell.Create(True, 'c:\Users\Bob\Documents\FPC\hunspell4\en_US.dic');  
Win10 64-bit / Lazarus 64-bit 2.0.12 / FPC 3.2.0

dbannon

  • Hero Member
  • *****
  • Posts: 1337
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "ASpell" spell checker
« Reply #2 on: January 21, 2021, 03:14:46 am »
Did you see the wiki page https://wiki.freepascal.org/spelling  ?

It has a lot of info based on Hunspell.

> I am using 32-bit version of Laz on Win10.

Thats interesting.  Forum user rvk compiled a 64bit DLL for me some time ago, I could not cope with the Windows stuff !  If you are using a 32bit version of Lazarus, (and making a 32bit windows app) my guess is that the 64bit DLL will not work for you. I may well be wrong.  Unless of course, you have built or otherwise acquired a 32bit DLL ?

Anyway, looks like you are using my code, FindLibrary() drops some debug lines that may tell you just what failed or you can use the debugger to step through the code. It really does not do anything much in Windows, just looks for the dll in same directory as the executable.  So, either the DLL is there and the code cannot find it (sorry, sounds like me) or its not there and, quite rightly fails.

Davo



Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

bobonwhidbey

  • Sr. Member
  • ****
  • Posts: 473
    • Double Dummy Solver - free download
Re: "ASpell" spell checker
« Reply #3 on: January 21, 2021, 03:55:08 am »
The .dic file is, of  course, a text file. Mine has just under 50,000 lines/words so not a small dictionary. What .dll do I need to have in the EXE folder?
Win10 64-bit / Lazarus 64-bit 2.0.12 / FPC 3.2.0

dbannon

  • Hero Member
  • *****
  • Posts: 1337
    • tomboy-ng, a rewrite of the classic Tomboy
Re: "ASpell" spell checker
« Reply #4 on: January 21, 2021, 04:24:07 am »

Again, Did you see the wiki page https://wiki.freepascal.org/spelling  ?

The library contains the Hunspell code. If the function, FindLibrary() fails, its possible your problem is the library, not the dictionary.

Please read the wiki page https://wiki.freepascal.org/spelling

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

Raf20076

  • Full Member
  • ***
  • Posts: 138
    • https://github.com/Raf20076
Re: "ASpell" spell checker
« Reply #5 on: January 21, 2021, 04:35:42 pm »
Hi there

You can check your hunspell.dll (what functions are inside .dll) with free dll_export_viewer from https://www.nirsoft.net/utils/dll_export_viewer.html. If the name of the functions in .dll differ (not the same like in hunspell wrapper (unit) you use, it could not work.

Use hunspell wrapper from https://github.com/davidbannon/hunspell4pas and hunspell.dll (64bit) https://github.com/davidbannon/hunspell4pas/tree/main/DLL
or from my example https://github.com/Raf20076/Lazspell (hunspell.dll is 32bit)

If you create 32bit application you must use 32bit hunspell.dll
If you create 64bit application you must use 64bit hunspell.dll

Dictionaries must be coded in UTF8
« Last Edit: January 21, 2021, 06:20:30 pm by Raf20076 »

 

TinyPortal © 2005-2018