DokuWiki

It's better when it's simple

Outils pour utilisateurs

Outils du site


fr:spell_checker

Vérificateur d'orthographe

experimental

DokuWiki a une option de vérification d'orthographe. C'est une réécriture très proche de l'outil de Garrison Locke AJAX spellchecker.

Voici les différences et les fonctionnalités:

  • Entièrement intégré à DokuWiki
  • Pas besoin de l'extension pspell mais utilise le programme aspell à la place
  • Utilise SACK pour l'AJAX
  • Montre les problèmes et les suggestions en une seule passe

Appeler le vérificateur d'orthographe

Quand le vérificateur d'orthographe est activé dans config et que votre navigateur le supporte, vous avez un bouton supplémentaire Toolbar: qui lance la vérification. Cela vérifiera votre texte et passera en mode correction avec tous les mots inconnus ou mal orthographiés soulignés en rouge. Vous pouvez cliquer sur ces mots pour avoir la liste des suggestions ou changer manuellement le mot. Lorsque vous avez fini de corriger votre texte, utilisez le bouton pour retourner en mode édition.

Note: La vérification d'orthographe peut prendre du temps, particulièrement lorsque votre texte est long ou contient beaucoup d'erreurs.

Besoins requis

  • Pour utiliser le correcteur orthographique, vous devez avoir un navigateur compatible avec AJAX. Ces navigateurs sont compatibles:
    • Firefox 1.0.4 ou plus récent.
    • Internet Explorer 6
    • Opera 8.0
    • Konqueror 3.3.2
    • Safari
  • Installer GNU aspell Version 0.60+ sur le serveur qui héberge le wiki
  • PHP 4.3.0+
  • Un dictionnaire aspell pour votre langue utilisé dans votre wiki

Liste de mots personnelle

Lors de la vérification orthographique, DokuWiki peut utiliser une liste personnelle complémentaire de mots. Le fichier doit être nommé conf/words.aspell – Voir le Manuel d'Aspell pour le formatage du fichier.

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

Si vous utilisez 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

Credits

Philippe LAPEYRIE 2006-05-18 23:42
Kevin FAUCHON 2006-12-30 12:47

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
fr/spell_checker.txt · Dernière modification : de Laynee

Sauf mention contraire, le contenu de ce wiki est placé sous les termes de la licence suivante : 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