スペルチェック
DokuWiki has an optional SpellChecker. This is a nearly complete rewrite of the Garrison Locke's AJAX spellchecker.
Here are the differences and features
- seamless integrated into DokuWiki
- no need for the pspell extension but uses aspell instead
- uses SACK for AJAX
- gets mistakes and suggestions in one transfer
Invoking The SpellChecker
When the spellchecker is enabled in the config and your Browser supports it, you get an additional QuickButton: which enables the spellchecker. It will check your text and switch to the correction mode with all unknown or misspelled words underlined red. You can click them to get a list of suggestions or make manual changes to the word. After you finished correcting your text press the button to return to the editing mode.
Please note: Spellchecking can take some time, especially when your text is large or contains many mistakes.
Requirements
Personal Wordlist
DokuWiki can use an additional personal wordlist when spell checking. The file needs to be named conf/words.aspell
– refer to the Aspell Manual for the format needed.
Installation
Windows
Note: if you are using PHP5 and IIS6, this cannot be made to work; anything returned from aspell is, for some reason, ignored.
- Use the nice point and click installers to install Aspell and at least one dictionary. If you're using an English dictionary you can download Aspell 0.60.3 for Win32 from No Status Quo. If you're not using an English dictionary currently only 0.5.x pre-compiled Aspell binaries exist here; however these (seem to) work fine. 1)
- Edit your dokuwiki.php config file (or better, edit/create local.php) to activate the spell checker *and* to give the path to Aspell, e.g, from my local.php:
$conf['spellchecker']= 1; define ('ASPELL_BIN','C:\apachefriends\xampp\Aspell\bin\aspell.exe');
You'll notice that the path to aspell.exe does not contain any spaces. If you have installed Aspell to 'Program Files', you will have to use the abbreviation that Windows generates, i.e. 'C:\PROGRA~1\Aspell\bin\aspell.exe'
(This is the setting you want to use if you've used Aspell from No Status Quo.)
You can list the abbreviated directory names by entering dir /x
at the command prompt - this will give you the Windows abbreviation for folders contained in that folder.
When Using the Either of the ASPELL installs with version 2006-03-09 I just receive the error
"An error Occured while trying to run the spellchecker: Could not run ASPELL 'C:\PROGRA~1\Aspell\bin\aspell.exe'."
I am using IIS 6 and PHP5. Any Ideas??
It works with IIS 5 and PHP4, so it might simply be incompatible with the newer versions. I'd suggest googling the heck out of it. — DGM2 2006-04-25 19:12
I got the same problem. Try add IUSR_
permissions to read and execute cmd.exe
, located somewhere in System32
, current windows directory. Warning: this can reduce your system security (yet: who cares ?)
— Tomasz 2006-10-02 21:00
Debian
If you are running Debian:
#> apt-get install aspell
Gentoo
If you are running Gentoo:
#> emerge -a aspell
You also need to install a language package, if you don't wish to use English. Ex for danish:
#> emerge -a aspell-da
For a complete list of available language packages use:
#> emerge -s aspell
OpenBSD and FreeBSD
For some reason dokuwiki doesn't find aspell, so you need a include path in dokuwiki.php
.
Note that for recent versions of DokuWiki conf/local.php
should be used for overriding the
configuration defaults stored in conf/dokuwiki.php
.
define ('ASPELL_BIN','/usr/local/bin/aspell');
Also, make sure that if you run Apache chrooted (default on OpenBSD) you installed aspell in chroot path
Comments/Discussion
It doesn't look like spellcheck.php is ever being called for me. I even changed the name of the file in the hopes of generating an error but none aee reported. I did check to see that this.run = function(){… was being called in spellcheck.js and it is. I also checked the value of this.handler in spellcheck.js and it looks good.
— Dennis 2006-05-31 11:47
When I try to use the spellchecker, I get this error message:
An error occured while trying to run the spellchecker: Aspell returned an error: sh: line 1: /aspell: No such file or directory
My aspell
is located in /usr/bin
and I added this line to my local.protected.php
(I'm using Config plugin):
define ('ASPELL_BIN','/usr/bin/aspell');
I even tried to add it to dokuwiki.php
, spellcheck.php
and aspell.php
before but it didn't help. Safe mode is turned off. What am I doing wrong?
— Michał Tkacz 2005-11-22 14:10
Forget my above comment. Safe mode was turned on for that particular directory.
— Michał Tkacz 2006-01-11 23:25
It's possible to use PHP's safe mode and DokuWiki's spell checker together by using the PHP option “safe_mode_exec_dir”.
Let's assume you have enabled PHP's safe mode in your Apache configuration like this:
# make php more secure php_admin_value safe_mode 1
Let's assume further, you're using Fedora Core as your operating system. To get DokuWiki's spell checker work, follow these steps (of course, you have to be root):
0. Install aspell and additional dictionaries if necessary e. g.
yum -y install aspell aspell-de [...]
1. Copy the aspell binary to your DokuWiki installation e. g.
cp /usr/bin/aspell /var/www/sites/wiki.domain.example/bin/
2. Change the owner of the (new) aspell binary e. g.
chown apache:apache /var/www/sites/wiki.domain.example/bin/aspell
3. Change your Apache configuration like this:
# make php more secure php_admin_value safe_mode 1 php_admin_value safe_mode_exec_dir "/var/www/sites/wiki.domain.example/bin"
4. Execute “/etc/init.d/httpd reload” and you're through.
— Alexander Hoff / Chirado OHG 2006-03-11 18:40
To let your users edit the personal wordlist, you may do the following. Modify lib/exe/spellcheck.php
by adding following line at the top of the file:
require_once(DOKU_INC.'inc/pageutils.php');
and replacing following lines:
//add personal dictionary if(@file_exists(DOKU_INC.'conf/words.aspell')){ $spell->personal = DOKU_INC.'conf/words.aspell'; }
with:
//add personal dictionary if(@file_exists(wikiFN($conf['personal']))) { $spell->personal = wikiFN($conf['personal']); }
Then add following line to your conf/local.php
:
$conf['personal'] = 'ignore-list';
where ignore-list
is the name of the page containing personal wordlist (it may include namespace).
Be aware that the format of the personal wordlist is quite restrictive.
— Michał Tkacz 2006-01-14 13:07
I can't seem to get the spell checker to work. I have aspell 60.3 installed, added the two lines to local.php as recommended, and even granted the IUSR_.. account read/execute permissions to the aspell directory. When you click on the spell check button, the text area window dims briefly, and the tool tip for the button indicates “No mistakes found”. Anyone else get this to work on Windows Server 2003 w/IIS 6? I get the same results using both IE and Firefox. — GaryV 2006-06-25 11:30
This sounds like the same issue I mentioned above. I've spend many hours trying to figure this out. — Dennis 2006-06-26 23:47
Try add IUSR_
permissions to read and execute cmd.exe
, located somewhere in System32
, current windows directory. Warning: this can reduce your system security (yet: who cares ?)
— Tomasz 2006-10-02 11:00
Possible errors
Aspell version
My system has a newly installed Aspell 0.60.4, and spell-check hasn't worked. I always got an error message, but without Aspell's error. I've modified the inc/aspell.php:
// close process $exitcode=proc_close($process); //Always got '-1' :-o if ($err){ //Modified rule //something went wrong $err = "Aspell returned an error(".ASPELL_BIN." exitcode: " . $exitcode . "):\n" . $err; return false; }
It's working fine in my system now with this modification.
— Péter Szládovics 2005-11-23 15:38
Just to confirm this also fixed things for me, using aspell-0.60.4 on Linux (Fedora Core 4). Thx. — Robert Meerman 2006-03-09 03:48