DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:spellcheck

Spell Checker Plugin

Compatible with DokuWiki

Lemming

plugin Integrates an Aspell based spell checker into the edit toolbar

Last updated on
2018-03-06
Provides
Helper
Repository
Source

This extension is marked as obsoleted. Therefore it is hidden in the Extension Manager and the extension listing. Furthermore, it is candidate for removal.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with !discontinued, !obsolete, spellcheck, toolbar

This is the same spell checker that was included in the previous DokuWiki releases. The spell checking component is no longer integrated into DokuWiki. Instead this plugin can be installed.

:!: Note: since all modern browsers include spell checkers now, I consider this plugin obsolete and will no longer maintain it. If someone wants to take over maintaining it, just contact me. — Andreas Gohr 2008/10/07 23:37

This is a nearly complete rewrite of Garrison Locke's AJAX spellchecker.

Here are the differences and features

  • seamlessly integrated into DokuWiki
  • no need for the pspell extension but uses Aspell instead
  • uses SACK for AJAX
  • gets mistakes and suggestions in one transfer

Download and Install

Please use the download link given above to install the plugin through the plugin manager or to download it manually.

Invoking The SpellChecker

When the spellchecker plugin is installed and your browser supports it, you get an additional toolbar button: 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

  • To use the spellchecker you need an AJAX compatible web browser. These Browsers are known to work:
    • Firefox 1.0.4 or higher
    • Internet Explorer 6
    • Opera 8.0
    • Konqueror 3.3.2
    • Safari
  • GNU aspell Version 0.60+ on the Wiki server installed
  • PHP 4.3.0+
  • An Aspell dictionary for the language you use in your wiki

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.

Aspell 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)

  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 Occurred 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 found that Tomasz's suggested hack (next comment) works on small pages with my configuration (Windows XP or 2000, IE6, Aspell 6.0.3, PHP5.2), but it doesn't work with longer pages. And, I DO care about the enormous gaping hole that causes in the already shaky IE security. There needs to be a better solution than this. — DGM2 2007-02-15 18:02

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

BitNami DokuWiki Stack

I recently installed the BitNami DokuWiki Stack on a Windows XP Pro box, which means that, even though it's running on Windows, it's using Apache as the webserver. It also uses PHP 5.2 and the 2008-05-05 release of DokuWiki, and everything (so far) works perfectly, except spellchecking.

I was able to get it to work, somewhat, but I had to resort to taking steps that haven't been necessary for several years, which is ridiculous. By manually editing the local.php to include a

define ('ASPELL_BIN','C:\Progra~1\Aspell\bin\aspell.exe'); 

line, I was able to get the Spellcheck Plugin to work on this Stack, IF the page is small enough. And that means tiny!. This is the same behavior people were reporting back in 2005!

It seems that the problem is the timeout setting, which is 13 seconds. If Aspell can't process the page and return the results in 13 seconds, DokuWiki times out and displays the error message. I've tried setting the timeout property in the script.js file to 130 seconds, like this

    // abort after 13 seconds
    this.timer = window.setTimeout(ajax_spell.timedOut,130000);

but, it seems to ignore that change. The only change is an additional 0 in the last parameter, 130000 instead of 13000. (I don't really want to wait over 2 minutes for a spellchecker, but it seemed like a good value for testing.)

Another problem with this behavior is that DokuWiki does not release the editing lock on the page you tried to spellcheck, and won't let you Cancel out of Edit Mode. That's a real pain.

What's the deal, Andi? I can't believe this is really beyond your abilities, so why has this been a problem for so long? If this is supposed to be a tool for creating and managing “Dokumentation”, spellchecking is fundamental, not optional. — DGM2 2008/09/09 21:14

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 occurred 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

I found that Tomasz's suggested hack works with my configuration (WinXP, IE6, ASpell 6.0.3, PHP5.2), but I DO care about the enormous gaping hole that causes in the already shaky IE security. There needs to be a better solution than this. — DGM2 2007-02-15 17:43

My DokuWiki installation suffered from a missing toolbar after upgrading to DokuWiki's last version. The problem is caused by this very plugin (checked two times, finally deleted). I do not know why. Have any idea? Thanks,

Richard Márquez 2010-06-11 19:06

I have the same problem (missing toolbar), latest DokuWiki release. - Ro bSwindell

Interferes with Struct Plugin:

Having this plugin enabled made it impossible for me to add data to a Lookup Scheme with the Struct Plugin. Probably not something that happens to many people, since this is pretty much obsolete. I thought I'd just add the info to help people who installed this without checking its status. The problem seems to be the addInitEvent. — Blind_Mapmaker 2018-07-29 11:49

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
For the PHP-illiterate among us, does it matter where that code is inserted? I'm still getting an error –lenehey

Indentation corruption

in spellcheck.php line 122 change the two space replacement to double HTML code otherwise it will incorrectly remove one of the space indents on every cascaded list item when you click the “Check Spelling” button.

  $string = preg_replace('/  /','  ',$string);

Bobby Metz 2008-01-10 15:30

Unicode Characters

in spell_checker.php line 190 add \pL for unicode characters like German üöäß

preg_match("/[A-Z\pL']{1,16}/i", $words[$i][$j], $tmp);

get the word that is in the array slot $i

1)
In my setup it does not work, if the size of page to check is too large — Konrad Bauckmeier 2005-10-17 15:38
plugin/spellcheck.txt · Last modified: 2023-10-31 00:24 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki