The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lingua::StarDict::Gen - Stardict dictionary generator

SYNOPSIS

  use Lingua::StarDict::Gen;

  $dic = { word1 => ...
           word2 => ...
         }

  Lingua::StarDict::Gen::writeDict($dic,"dicname" [,"dirpath"]);
  Lingua::StarDict::Gen::escreveDic($dic,"dicname" [,"dirpath"]);

  $dic=Lingua::StarDict::Gen::loadDict("file");
  $dic=Lingua::StarDict::Gen::carregaDic("file");

DESCRIPTION

This module generates StarDict dictionaries from HASH references (function escreveDic).

This module also imports a simple dictionary (lines with word {def1; def2...})(function carragaDic).

ABSTRACT

Lingua::StarDict::Gen is a perl module for building Stardict dictionaries from perl Hash.

Also included perl script for making stardicts form term-format and thesaurus-format.

FUNCTIONS

writeDict

escreveDic

  Lingua::StarDict::Gen::writeDict($dic,"dicname");
  Lingua::StarDict::Gen::writeDict($dic,"dicname", dir);

Write the necessary files StarDict files for dictionary in $dic HASH reference.

dir is the directory where the StarDict files are written.

If no dir is provided, Lingua::StarDict::Gen will try to write it in /usr/share/stardict/dic/... (the default path for StarDict dictionaries). In this case the dictionary will be automatically installed.

loadDict

carregaDic

This function loads a simple dictionary to a HASH reference.

  $dic=Lingua::StarDict::Gen::loadDict("file");

Where file has the following sintax:

  word{def 1; def 2;... ;def n}

Example (default format):

 %encoding utf8
 cat{gato; tareco; animal com quatros patas e mia}
 dog{...}

Example2 (terminology format):

 %encoding utf8

 EN cat ; feline
 PT gato ; tareco
 DEF animal com 4 patas e que mia

 EN house; building; appartment 
 PT house
 FR maison
 ...

In this case we must say the type used:

  $dic=Lingua::StarDict::Gen::loadDict({type=>"term"},"file");

or even specify the language:

  $dic=Lingua::StarDict::Gen::loadDict(
        {type=>"term", lang=>"PT"},"file");

See also the script term2stardic in the destribution.

mostraDic

showDict

 showDict($hash);

Prints to stdio the information in the hash in the form

 word -> definition

Authors

José João Almeida

Alberto Simões

Paulo Silva

Paulo Soares

Nicolav Shaplov

SEE ALSO

stardict

perl

wiktionary-export/trunk/StarDict

COPYRIGHT & LICENSE

Copyright 2008 J.Joao, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.