Adding new dictionaries to aspell: Difference between revisions

(Updating this document to be accurate to Zimbra 8.7, and removing some old 4.X text which is no longer relevant.)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
ZCS 6.0 comes with dictionaries preinstalled for many languages.  ZCS versions 5.0 and earlier only have English installed.  To see the list of installed languages, run
=Adding new dictionaries to aspell=
<tt>
<div class="col-md-12 ibox-content">
::/opt/zimbra/aspell/bin/aspell dump dicts
{{KB|{{Unsupported}}|{{ZCS 8.7}}||}}
</tt>
 
ZCS 8.7 comes with dictionaries preinstalled for many languages.  ZCS versions 5.0 and earlier only have English installed.  To see the list of installed languages, run
/opt/zimbra/common/bin/aspell dump dicts


If you do not see your language in the list, follow the instructions below.
If you do not see your language in the list, follow the instructions below.


From : Miss Benita Latta
== How to add a new dictionary to aspell ==
Kumasi Ghana From,
* Download the dictionary for the language you want from [ftp://ftp.gnu.org/gnu/aspell/dict ftp.gnu.org/gnu/aspell/dict].
West Africa.
* Extract it from the tar file in a temporary directory.
Email: benitamylatta@btinternet.com
* Set PATH to the binary directory of Zimbra:
   
  PATH=/opt/zimbra/common/bin:$PATH
RE: APPEAL FOR URGENT & CONFIDENTIAL BUSINESS ASSISTANCE!
* Configure and install the dictionary according to the README:


Dearest One,
  ./configure
   
  make
I am introducing myself as Miss Benita Latta the only daughter of late Chief and Mrs. Michael C.F latta. My father was a very wealthy Gold Dust merchant in Kumasi, the economic capital of Ghana; my father was poisoned to death by his business associates during one of their outings on a business trip. My mother died when I was a baby and since then my father took me so special.
  make install
   
Before the death of my father on November 2009 in a private hospital here in Kumasi he secretly called me on his bed side and told me that he has the sum of Seven million, five hundred thousand United State Dollars ($US7.5M) left in fixed / suspense account in one of the prime bank here in Ghana, that he used my name as his only daughter for the next of Kin in depositing of the fund. He also explained to me that it was because of this wealth that he was poisoned by his business associates.
   
That due to the incessant political crisis in this country and to avoid been kill by his enemies I should seek for a foreign partner in a country of my choice where I will transfer this money and use it for investment purpose such as real estate or hotel management.


Please, I am honorably seeking your assistance in the following ways:
* Verify the datadir and dictdir it must be '''/opt/zimbra/common/lib/aspell-0.60'''
(1) To provide a bank account into which this money would be transferred to.
(2) To serve as a guardian of this fund since I am still a small girl
(3) To make arrangement for me to come over to your country to further my education and also to secure a resident permit in your country. Moreover, I am willing to offer you 15% of the total sum as compensation for your effort/ input after the successful transfer of this fund into your nominated account overseas. Furthermore, Pls indicate your options towards assisting me as I believe that this transaction would be conclude within seven (7) days you signify your interest to assist me. For my security reasons,
Anticipating to hear from you urgently.
Thanks and God bless.
Yours Sincerely,
Benita Latta


== Changes required for ZCS 5.0 and earlier ==
You must reload the spell-service:
The following information is for ZCS versions 5.x or earlier. Starting with ZCS 6.x, the client passes the name of the dictionary to the server and multibyte character sets are handled properly.
  sudo -u zimbra /opt/zimbra/bin/zmspellctl reload


* Edit the file /opt/zimbra/httpd/htdocs/aspell.php to reference the new dictionary.  For example to add the french dictionary:
{{Article_Footer|Zimbra Collaboration Suite 8.7|3/9/2017}}
 
<tt>
::$locale = "en_EN";
::TO
::$locale = "fr_FR";
</tt>
 
<b>NOTE (fr):</b> Read the README on the dict source directory to choice the right setup (fr_FR-40, fr_FR-60, etc)<br>
<b>NOTE:</b> 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)
 
<pre><nowiki>
$suggestions = implode(",", pspell_suggest($dictionary, $word));
$misspelled .= "$word:$suggestions\n";
</nowiki></pre>
 
with this one:
<pre><nowiki>
$suggestions = implode(",", pspell_suggest($dictionary, $word));
$suggestions=iconv("iso-8859-1","UTF-8",$suggestions);
$misspelled .= "$word:$suggestions\n";
</nowiki></pre>
 
<b>NOTE:</b> After changing the aspell language restart the spellchecker as the user zimbra with the following command:
 
<pre><nowiki>
zmspellctl stop; zmspellctl start
</nowiki></pre>
 
There is also a problem when splitting words. Replace (line 48 or so)
<pre><nowiki>
$words = preg_split('/[^\w\'-] /', $text);
</nowiki></pre>
 
with this one:
<pre><nowiki>
$words = preg_split('/[^\w\'\xc0-\xfd-]+/', $text);
</nowiki></pre>
 
This regexp line should be enough for most western Europe languages (Spanish, French, German, Portuguese and Italian). It includes all ISO8859 europeean letters in the range 192-253 of the table below.
 
http://www.pemberley.com/janeinfo/latin1.gif
 
 
* To add a set of custom words see this [http://aspell.sourceforge.net/man-html/Creating-an-Individual-Word-List.html How-To]
 
 
=== Adding Latin-2 dictionary support ===
Many aspell dictionaries do not use UTF-8 encoding while UTF-8 is encoding of a choice for Zimbra suite.
This means that text should be converted from UTF-8 to ISO-8859-x, spell checked ant then misspeled and sugested word should be
translated back to UTF-8 for browser display. The following patch shows (Slovenian) modifications to Zimbra 4.5.9 spelling processor:
 
--- /opt/zimbra/httpd/htdocs/aspell.php.orig  2007-11-01 14:44:25.000000000 +0100
+++ /opt/zimbra/httpd/htdocs/aspell.php        2007-11-01 15:50:04.000000000 +0100
@@ -18,7 +18,7 @@
 
  $filename = "";
  $text = "";
-$locale = "en_EN";
+$locale = "sl_SI";
 
  if (isset($_FILES["text"])) {
      $text = file_get_contents($_FILES["text"]);
@@ -33,12 +33,17 @@
  if ($text != NULL) {
      setlocale(LC_ALL, $locale);
 
+    // Convert all text into 8-bit dictionary locale
+    $text=iconv("UTF-8", "iso-8859-2", $text);
+
      // Get rid of double-dashes, since we ignore dashes
      // when splitting words
      $text = preg_replace('/--+/', ' ', $text);
 
      // Split on anything that's not a word character, quote or dash
-    $words = preg_split('/[^\w\'-]+/', $text);
+    // $words = preg_split('/[^\w\'-]+/', $text);
+    // Do not split visible characters in the range of 0xA0-0xFF
+      $words = preg_split('/[^\w\'\xa0-\xff-]+/', $text);
 
      // Load dictionary
      $dictionary = pspell_new($locale);
@@ -79,14 +84,15 @@
          } else {
              $checked_words[$word] = 1;
          }
-
          // Check spelling
          if (!pspell_check($dictionary, $word)) {
              $suggestions = implode(",", pspell_suggest($dictionary, $word));
-            $suggestions = utf8_encode($suggestions);
              $misspelled .= "$word:$suggestions\n";
          }
      }
+  // Convert to dictionary locale
+  $suggestions=iconv("iso-8859-2","UTF-8",$suggestions);
+  $misspelled = iconv("iso-8859-2","UTF-8",$misspelled);
 
      $response = new ServerResponse();
      $response->addParameter("misspelled", $misspelled);
 
{{Article_Footer|unknown|2/22/2006}}


[[Category:Spell]]
[[Category:Customizing ZCS]]
[[Category:Customizing ZCS]]
[[Category:Spell]]

Latest revision as of 13:05, 9 March 2017

Adding new dictionaries to aspell

   KB 1295        Last updated on 2017-03-9  




0.00
(0 votes)

ZCS 8.7 comes with dictionaries preinstalled for many languages. ZCS versions 5.0 and earlier only have English installed. To see the list of installed languages, run

/opt/zimbra/common/bin/aspell dump dicts

If you do not see your language in the list, follow the instructions below.

How to add a new dictionary to aspell

  • Download the dictionary for the language you want from ftp.gnu.org/gnu/aspell/dict.
  • Extract it from the tar file in a temporary directory.
  • Set PATH to the binary directory of Zimbra:
PATH=/opt/zimbra/common/bin:$PATH
  • Configure and install the dictionary according to the README:
./configure
make
make install
  • Verify the datadir and dictdir it must be /opt/zimbra/common/lib/aspell-0.60

You must reload the spell-service:

sudo -u zimbra /opt/zimbra/bin/zmspellctl reload
Verified Against: Zimbra Collaboration Suite 8.7 Date Created: 3/9/2017
Article ID: https://wiki.zimbra.com/index.php?title=Adding_new_dictionaries_to_aspell Date Modified: 2017-03-09



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search