Difference between revisions of "spelling"

From Free Pascal wiki
Jump to navigationJump to search
Line 31: Line 31:
 
=== Mac ===  
 
=== Mac ===  
 
The author's Mac appears to have had the Hunspell library installed when Sierra was installed. But maybe, just maybe, if came along with Firefox. I'd like some feed back ....
 
The author's Mac appears to have had the Hunspell library installed when Sierra was installed. But maybe, just maybe, if came along with Firefox. I'd like some feed back ....
 +
 +
 +
 +
== The Hunspell Unit ==
 +
 +
 +
 +
== The Test Programme ==
 +
 +
 +
 +
== Downloads ==
 +
 +
* The Hunspell Pascal Unit
 +
* The complete demo programme
 +
* The Windows 64 bit DLL
 +
 +
== Further Reading ==

Revision as of 11:35, 18 February 2018

Using hunspell with Lazarus

This page is under development as of Feb, 2018

This page is about using the hunspell library with Lazarus. It outlines a model that does, sort of, work. You will almost certainly need to make some changes for your specific purposes but hopefully, this page will give you a good start.

Firstly, in the forum, there are several references to some code that will work with the hunspell library. The hunspell.pas unit is based heavily on these blocks of code. Most have no license information and an assumption is being made that they are "common knowledge" and thus free of any constraint. I have added a bit that manages the problem of finding the library and dictionary files. And established a reasonable interface.

Further, user rvk from the forum has build a windows 64 bit DLL as there seemed little alternative for Windows users.


About Hunspell

Hunspell is an active open source project, distributed under the Mozilla Public License. The hunspell library is used in products like Libra Office, Open Office and Firefox. Its can be made work on Windows, Linux and Mac (and probably heaps of other platforms). See the platform Specif pages below. Dictionaries for Hunspell are readily available and may already be installed on many machines. Even if you cannot access another applications's library, you can use its dictionary.


Platform Specific

Linux

Many Linux distrobutions will have Hunspell installed by default along with the appropriate language dictionaries. If not, its probably just a case of using the distrubtions's package manager. If all else fails, grab the source from the hunspell github site and build it yourself.

To see if you do in fact have a hunspell library installed, try this command - ldconfig -p | grep hunspell. Similarly, you can probably find some dictionaries with ls -l /usr/share/hunspell. If that does not work, try find /usr -name *.aff, it will take a bit longer ..

Windows

Installing the hunspell library on windows is more of an issue. There is apparently no pre compiled 'kit' available and most Windows apps that use Hunspell appear to bind it staticly thus no hunspell.dll left lying around for you to use. But just to be sure, try searching for *hunspell*.dll. The Hunspell github site lists a recipe to build one but it involves installing MSYS2 and is quite involved. The resulting DLL also needs a couple of gcc DLLs along as well.

Fortunately user rvk on the Lazarus Forum build us a nice statically (ie stand alone) linked DLL using Microsoft Visual Studio Community 2015. As such, you can use and distribute this DLL with your programme subject to the Mozilla Public License.

Mac

The author's Mac appears to have had the Hunspell library installed when Sierra was installed. But maybe, just maybe, if came along with Firefox. I'd like some feed back ....


The Hunspell Unit

The Test Programme

Downloads

  • The Hunspell Pascal Unit
  • The complete demo programme
  • The Windows 64 bit DLL

Further Reading