差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

dokuwiki:ja:spell_checker [2006/11/11] – 作成 administratordokuwiki:ja:spell_checker [2022/03/12] (現在) – 外部編集 127.0.0.1
行 1: 行 1:
 +====== スペルチェック ======
 +
 +[[experimental]]
 +
 +DokuWiki has an optional SpellChecker. This is a nearly complete rewrite of the Garrison Locke's [[http://www.broken-notebook.com/spell_checker/index.php|AJAX spellchecker]].
 +
 +Here are the differences and features
 +
 +  * seamless integrated into DokuWiki
 +  * no need for the pspell extension but uses aspell instead
 +  * uses [[http://twilightuniverse.com/2005/05/sack-of-ajax/|SACK]] for AJAX
 +  * gets mistakes and suggestions in one transfer
 +
 +
 +===== Invoking The SpellChecker =====
 +
 +When the spellchecker is enabled in the [[config#spellchecker|config]] and your Browser supports it, you get an additional [[QuickButton]]: {{http://wiki.splitbrain.org/lib/images/toolbar/spellcheck.png}} 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 {{http://wiki.splitbrain.org/lib/images/toolbar/spellstop.png}} 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 [[wp>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 [[http://aspell.sf.net|aspell]] Version 0.60+ on the Wiki server installed
 +  * PHP 4.3.0+ 
 +  * An aspell dictionary for the [[wiki:config#lang|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 [[http://aspell.net/man-html/Format-of-the-Personal-and-Replacement-Dictionaries.html#Format-of-the-Personal-and-Replacement-Dictionaries|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 [[http://www.nosq.com/download/aspell-0.60.3.exe|Aspell 0.60.3 for Win32]] from [[http://www.nosq.com/blog/2005/07/aspell-0603-for-win32/|No Status Quo]].  If you're not using an English dictionary currently only 0.5.x pre-compiled Aspell binaries exist [[http://aspell.net/win32/|here]]; however these (seem to) work fine. ((In my setup it does not work, if the size of page to check is too large  --- // Konrad Bauckmeier 2005-10-17 15:38//))
 +  - 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 [[http://www.nosq.com|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\\
 +<code>
 +"An error Occured while trying to run the spellchecker: 
 +Could not run ASPELL 'C:\PROGRA~1\Aspell\bin\aspell.exe'." 
 +</code>
 +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.  --- //[[david.mcneill@ge.com|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|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?
 +
 +--- //[[mehow@autocom.pl|Michał Tkacz]] 2005-11-22 14:10//\\
 +
 +Forget my above comment. Safe mode was turned **on** for that particular directory.
 +
 +--- //[[mehow@autocom.pl|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 [[http://httpd.apache.org|Apache]] configuration like this:
 +
 +<code>
 +   # make php more secure
 +   php_admin_value safe_mode 1
 +</code>
 +
 +Let's assume further, you're using [[wp>Fedora_Core|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.
 +
 +<code>
 +  yum -y install aspell aspell-de [...]
 +</code>
 +
 +1. Copy the aspell binary to your DokuWiki installation e. g.
 +
 +<code>
 +  cp /usr/bin/aspell /var/www/sites/wiki.domain.example/bin/
 +</code>
 +
 +2. Change the owner of the (new) aspell binary e. g.
 +
 +<code>
 +  chown apache:apache /var/www/sites/wiki.domain.example/bin/aspell
 +</code>
 +
 +3. Change your Apache configuration like this:
 +
 +<code>
 +   # make php more secure
 +   php_admin_value safe_mode 1
 +
 +   php_admin_value safe_mode_exec_dir "/var/www/sites/wiki.domain.example/bin"
 +</code>
 +
 +4. Execute "/etc/init.d/httpd reload" and you're through.
 +
 +--- //[[http://www.chirado.de|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:
 +<code>require_once(DOKU_INC.'inc/pageutils.php');</code>
 +and replacing following lines:
 +<code>
 +//add personal dictionary
 +if(@file_exists(DOKU_INC.'conf/words.aspell')){
 +  $spell->personal = DOKU_INC.'conf/words.aspell';
 +}
 +</code>
 +with:
 +<code>
 +//add personal dictionary
 +if(@file_exists(wikiFN($conf['personal']))) {
 +  $spell->personal = wikiFN($conf['personal']);
 +}
 +</code>
 +Then add following line to your ''conf/local.php'':
 +<code>$conf['personal'] = 'ignore-list';</code>
 +where ''ignore-list'' is the name of the page containing personal wordlist (it may include namespace).
 +Be aware that the [[http://aspell.net/man-html/Format-of-the-Personal-and-Replacement-Dictionaries.html#Format-of-the-Personal-and-Replacement-Dictionaries|format of the personal wordlist]] is quite restrictive.
 +
 +--- //[[mehow@autocom.pl|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@rochester.rr.com|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:\\
 +<code 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;
 +            }
 +</code>
 +It's working fine in my system now with this modification.\\
 +
 +----
 +
 + --- //[[peti@szladovics.hu|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@gmail.com|Robert Meerman]] 2006-03-09 03:48//