Difference between revisions of "Adding new dictionaries to aspell"

(How to add a new dictionary to aspell)
(How to add a new dictionary to aspell)
Line 23: Line 23:
 
Note: If you are using a non-english based language with special chars like tildes (spanish, for example), you have to modify aspell.php
 
Note: If you are using a non-english based language with special chars like tildes (spanish, for example), you have to modify aspell.php
  
This file is located at /opt/zimbra/httpd/htdocs/aspell.php. Replace this block (line 109 or so)
+
This file is located at /opt/zimbra/httpd/htdocs/aspell.php. Replace this block (line 82 or so)
  
 
<pre><nowiki>
 
<pre><nowiki>
Line 33: Line 33:
 
<pre><nowiki>
 
<pre><nowiki>
 
  $suggestions = implode(",", pspell_suggest($dictionary, $word));
 
  $suggestions = implode(",", pspell_suggest($dictionary, $word));
  $utf8suggestions=iconv("iso-8859-1","UTF-8",$suggestions);
+
  $suggestions=iconv("iso-8859-1","UTF-8",$suggestions);
  $misspelled .= "$word:$utf8suggestions\n";
+
  $misspelled .= "$word:$suggestions\n";
 
</nowiki></pre>
 
</nowiki></pre>
 +
 +
There is also a problem when splitting words. Replace (line 48 or so)
 +
<pre><wiki>
 +
$words = preg_split('/[^\w\'-]+/', $text);
 +
</wiki></pre>
 +
 +
with this one:
 +
<pre><wiki>
 +
$words = preg_split('/[^\w\'-áéíóúäëïöüàèùìòñçâêîôû]+/', $text);
 +
</wiki></pre>

Revision as of 01:40, 1 October 2006

How to add a new dictionary to aspell

  • Download the dictionary from gnu.org
  • Extract it from the tar file in a work directory
  • Set Zimbra's aspell in the path with:
PATH=/opt/zimbra/aspell-0.60.3/bin:$PATH
  • Configure and install the dictionary according to the README

./configure
make
make install

  • Edit the file /opt/zimbra/httpd/htdocs/aspell.php to reference the new dictionary. For example to add the french dictionary:

$dictionary = pspell_new("en_EN");
TO
$dictionary = pspell_new("fr_FR");

Note: If you are using a non-english based language with special chars like tildes (spanish, for example), you have to modify aspell.php

This file is located at /opt/zimbra/httpd/htdocs/aspell.php. Replace this block (line 82 or so)

 $suggestions = implode(",", pspell_suggest($dictionary, $word));
 $misspelled .= "$word:$suggestions\n";

with this one:

 $suggestions = implode(",", pspell_suggest($dictionary, $word));
 $suggestions=iconv("iso-8859-1","UTF-8",$suggestions);
 $misspelled .= "$word:$suggestions\n";

There is also a problem when splitting words. Replace (line 48 or so)

<wiki>
$words = preg_split('/[^\w\'-]+/', $text);
</wiki>

with this one:

<wiki>
$words = preg_split('/[^\w\'-áéíóúäëïöüàèùìòñçâêîôû]+/', $text);
</wiki>
Jump to: navigation, search