| 1 |
NAME |
| 2 |
|
| 3 |
Text::Hunspell - Perl interface to the Hunspell library |
| 4 |
|
| 5 |
DESCRIPTION |
| 6 |
|
| 7 |
Text::Hunspell is an interface to the GNU Hunspell library. GNU Hunspell is a |
| 8 |
Free and Open Source spell checker. The Text::Hunspell module is a thin XS |
| 9 |
wrapper around the Hunspell C++ Library. Hopefully this is obvious, but you |
| 10 |
MUST have the Hunspell library installed on your system as a .so library, |
| 11 |
before installing this module. You also MUST have any hunspell dictionary |
| 12 |
installed for "make test" to pass. |
| 13 |
|
| 14 |
Hunspell's location is http://hunspell.sourceforge.net |
| 15 |
|
| 16 |
See BUILD NOTES and CURRENT ISSUES below before reporting any bugs. |
| 17 |
|
| 18 |
This module has been built and passed all tests on the following platforms: |
| 19 |
|
| 20 |
perl 5.8.8 on Linux, gcc version 4.0.1 |
| 21 |
hunspell 1.2.8 or higher |
| 22 |
Mandriva Linux 2006 |
| 23 |
Knoppix Linux (Debian Linux) |
| 24 |
|
| 25 |
Please read SUPPORT below if you have trouble building Text::Hunspell. |
| 26 |
|
| 27 |
|
| 28 |
INSTALLATION |
| 29 |
|
| 30 |
Windows users see below. |
| 31 |
|
| 32 |
1) Install Hunspell and a Dictionary |
| 33 |
|
| 34 |
Make sure you have a current version of Hunspell installed. |
| 35 |
You must install both the Hunspell program and a dictionary. |
| 36 |
They are distributed as separate packages. The dictionary can be |
| 37 |
copied anywhere, since at startup the full path of the .dic/.aff files |
| 38 |
will be givern to hunspell. |
| 39 |
|
| 40 |
Hunspell and the dictionary packages contain README files that include |
| 41 |
installation instructions. Here's a basic overview: |
| 42 |
|
| 43 |
Hunspell must be installed first, then install the dictionary file and finally |
| 44 |
install the Text::Hunspell module. |
| 45 |
|
| 46 |
Hunspell installation example: |
| 47 |
1. download and untar hunspell |
| 48 |
2. cd hunspell |
| 49 |
3. ./configure |
| 50 |
4. ./make |
| 51 |
5. cd ./src/hunspell |
| 52 |
6. ./configure |
| 53 |
7. make |
| 54 |
8. copy makeso.sh file here |
| 55 |
9. sh makeso.sh and do manually the copy and 2 link commands |
| 56 |
as described at the end of makeso.sh |
| 57 |
10. cd ../tools |
| 58 |
11. ./configure |
| 59 |
12. make |
| 60 |
|
| 61 |
|
| 62 |
If you used a --prefix option to install Hunspell in a non-standard location you |
| 63 |
will need to adjust your path to include $PREFIX/bin. The configure script |
| 64 |
for the dictionary needs to find programs installed in the previous step. |
| 65 |
|
| 66 |
|
| 67 |
At this point you should be able to run Hunspell in interactive mode. |
| 68 |
For example: |
| 69 |
cd hunspell/src/tools |
| 70 |
./example full_path_aff full_path_dic file_to test |
| 71 |
|
| 72 |
|
| 73 |
2) Build and install this Text::Hunspell module. |
| 74 |
|
| 75 |
$ perl Makefile.PL |
| 76 |
$ make |
| 77 |
$ make test |
| 78 |
# make install |
| 79 |
|
| 80 |
|
| 81 |
If you installed Hunspell in a non-standard location (for example, if |
| 82 |
you don't have root access) then you will need to tell Makefile.PL where to |
| 83 |
find the library. |
| 84 |
|
| 85 |
For example, if Hunspell was installed in $HOME/local (--prefix=$HOME/local) |
| 86 |
and the perl module should be installed in the perl library $HOME/perl_lib: |
| 87 |
|
| 88 |
$ perl Makefile.PL PREFIX=$HOME/perl_lib \ |
| 89 |
CCFLAGS=-I$HOME/local/include \ |
| 90 |
LIBS="-L$HOME/local/lib -lhunspell" |
| 91 |
|
| 92 |
$ LD_RUN_PATH=$HOME/local/lib make |
| 93 |
$ make test |
| 94 |
$ make install |
| 95 |
|
| 96 |
Perl must have been buit with thread support in order to work with Text::Hunspell. |
| 97 |
|
| 98 |
WINDOWS USERS |
| 99 |
|
| 100 |
Randy Kobes has provided a PPM and the following instructions for installing |
| 101 |
Text::Hunspell on Windows. Thanks very much Randy. |
| 102 |
|
| 103 |
For installing on Win32, first get and install the "Full installer" |
| 104 |
executable at |
| 105 |
|
| 106 |
http://hunspell.net/win32/ |
| 107 |
|
| 108 |
this will install Hunspell into a location such as C:\Program Files\Hunspell. You |
| 109 |
will also need to fetch and install at least one of the precompiled |
| 110 |
dictionaries found on the same page. |
| 111 |
|
| 112 |
Make sure that the path to the Hunspell bin directory (e.g. C:\Program |
| 113 |
Files\Hunspell\bin\) is in your PATH environment variable. For help with |
| 114 |
setting your path see "set environment variables" in the Windows Help |
| 115 |
Utility. You may need to reboot or open a new shell window after setting |
| 116 |
your path. The Hunspell .dll file must be located in the PATH before using |
| 117 |
Text::Hunspell. |
| 118 |
|
| 119 |
Then, to install Text::Hunspell, type at a DOS prompt (all on one line) |
| 120 |
|
| 121 |
C:\> ppm install http://theoryx5.uwinnipeg.ca/ppms/Text-Hunspell.ppd |
| 122 |
|
| 123 |
for an ActivePerl 8xx version, or |
| 124 |
|
| 125 |
C:\> ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Text-Hunspell.ppd |
| 126 |
|
| 127 |
for an ActivePerl 6xx version. |
| 128 |
|
| 129 |
If you wish to build Text::Hunspell from source: |
| 130 |
|
| 131 |
If you want to build Text::Hunspell yourself, you'll need a C compiler, which |
| 132 |
must be the same one that your Perl is built with (for ActivePerl, this means |
| 133 |
VC++ 6). Assuming you have that, in addition to the "Full installer" binary |
| 134 |
package at http://hunspell.net/win32/, you'll also need to get and install the |
| 135 |
hunspell-dev package (also located at http://hunspell.net/win32/), which contains |
| 136 |
the necessary .lib and .h files needed to compile the Perl module. |
| 137 |
|
| 138 |
Like above, make sure the PATH environment variable points to the location of |
| 139 |
the installed Hunspell .dll file before building Text::Hunspell. |
| 140 |
|
| 141 |
Installation then proceeds as described for the Unix version: |
| 142 |
|
| 143 |
perl Makefile.PL |
| 144 |
nmake |
| 145 |
nmake test |
| 146 |
nmake install |
| 147 |
|
| 148 |
with the additional requirement of passing to 'perl Makefile.PL' the |
| 149 |
necessary arguments (e.g. INC and LIBS) to specify the locations of the lib |
| 150 |
and header files, if these were installed in a non-standard location. Make |
| 151 |
sure that if a non-standard location was used that this is added to your PATH |
| 152 |
environment variable before running the tests. |
| 153 |
|
| 154 |
|
| 155 |
SUPPORT |
| 156 |
|
| 157 |
Before contacting me with problems building Text::Hunspell please try and debug |
| 158 |
as much as possible. |
| 159 |
|
| 160 |
For example, if "make test" fails, then run in verbose mode: |
| 161 |
|
| 162 |
make test TEST_VERBOSE=1 |
| 163 |
|
| 164 |
That may show at what test is failing. It's easy to run the test |
| 165 |
script manually -- and you can even edit and add a few print statements to |
| 166 |
aid in debugging. |
| 167 |
|
| 168 |
For example: |
| 169 |
|
| 170 |
perl -Iblib/lib -Iblib/arch t/test.t | less |
| 171 |
|
| 172 |
Use of LD_RUN_PATH, CCFLAGS and LIBS as above may also help if the build |
| 173 |
process fails. |
| 174 |
|
| 175 |
Remember that you *must* have the English dictionary installed for tests to |
| 176 |
pass (sorry, have to check against some dictionary). Also, you may need to |
| 177 |
set your LANG variable to "en_US" so that the English dictionary is selected. |
| 178 |
|
| 179 |
If all else fails, use the request tracker at: |
| 180 |
|
| 181 |
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Hunspell |
| 182 |
|
| 183 |
|
| 184 |
BUILD NOTES / CURRENT ISSUES |
| 185 |
|
| 186 |
A number of people have reported the |
| 187 |
|
| 188 |
$speller->store_replacement() |
| 189 |
|
| 190 |
test failing on some platforms. I don't know why. Search google to find out |
| 191 |
why I don't know why. The code (from what I can tell) looks like it should be |
| 192 |
returning an error value, but fails on some platforms. Until I can get a |
| 193 |
better answer I'm going to assume Hunspell is broken and ignore the return value |
| 194 |
in t/test.t. So don't test the return value in your code, either. |
| 195 |
|
| 196 |
Some users of OS X have reported the test failing after calling clear_session(). |
| 197 |
The test is suppose to see if a word added to the session is removed after calling |
| 198 |
clear_session(). It's another error I have not been able to reproduce on the machines |
| 199 |
I tested on. |
| 200 |
|
| 201 |
|
| 202 |
"Pax" provided these notes: |
| 203 |
|
| 204 |
I just got Text::Hunspell to build and work under OpenBSD 3.7 and thought you |
| 205 |
might like a tiny suggestion: in the README, you might note that under this |
| 206 |
operating system you need to add -lstdc++ to the list of libraries you link |
| 207 |
against, e.g.: |
| 208 |
|
| 209 |
$ perl Makefile.PL \ |
| 210 |
PREFIX=/usr/local INSTALLDIRS=site \ |
| 211 |
CCFLAGS=-I/usr/local/include \ |
| 212 |
LIBS="-L/usr/local/lib -lhunspell -lstdc++" |
| 213 |
|
| 214 |
If you don't do this, then any attempt to use Text::Hunspell will throw |
| 215 |
thousands of unresolved symbol errors trying to load your shared object. |
| 216 |
This is against libhunspell in /usr/local/lib installed from the hunspell |
| 217 |
port in the OpenBSD 3.7 ports tree, FWIW. |
| 218 |
|
| 219 |
|
| 220 |
A number of Solaris uses have reported the need to set: |
| 221 |
|
| 222 |
LDFLAGS='-L/usr/local/lib -R/usr/local/lib' |
| 223 |
|
| 224 |
and also having to copy libstdc++* to /usr/lib. YMMV. |
| 225 |
|
| 226 |
|
| 227 |
Changes compared to Hunspell::text |
| 228 |
|
| 229 |
hunspell.h was modified, since classe Hunspell was heavily modified between |
| 230 |
1.2.8 and 1.4.x, among others methods spell and suggest got new parameters, |
| 231 |
that causes the function name to get modified from U _ZN8Hunspell5spellEPKc to |
| 232 |
U _ZN8Hunspell5spellEPKcPiPPc |
| 233 |
|