logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

WWW::Dict::Leo::Org - Interface module to dictionary dict.leo.org

Author

       Thomas v.D. <tlinden@cpan.org>

Description

WWW::Dict::Leo::Org is a module which connects to the website dict.leo.org and translates the given term.
       It returns an array of hashes. Each hash contains a left side and a right side of the result entry.

How To Report Bugs

       Use rt.cpan.org to report bugs, select the queue for WWW::Dict::Leo::Org.

       Please don't forget to add debugging output!

Methods

translate($term)
       Use this method after initialization to connect to dict.leo.org and translate the given term. It  returns
       an array of hashes containing the actual results.

        use WWW::Dict::Leo::Org;
        use Data::Dumper;
        my $leo = new WWW::Dict::Leo::Org();
        my @matches = $leo->translate("test");
        print Dumper(\@matches);

       which prints:

        $VAR1 = [
                {
                 'data' => [
                            {
                             'left' => 'check',
                             'right' => 'der Test'
                            },
                            {
                             'left' => 'quiz (Amer.)',
                             'right' => 'der Test    [Schule]'
                            ],
                            'title' => 'Unmittelbare Treffer'
                          },
                 {
                  'data' => [
                             {
                              'left' => 'to fail a test',
                              'right' => 'einen Test nicht bestehen'
                             },
                             {
                              'left' => 'to test',
                              'right' => 'Tests macheneinen Test machen'
                             }
                            ],
                  'title' => 'Verben und Verbzusammensetzungen'
                 },
                 'data' => [
                            {
                             'left' => 'testing  adj.',
                             'right' => 'im Test'
                            }
                           ],
                 'title' => 'Wendungen und Ausdrücke'
                }
               ];

       You might take a look at the leo script how to process this data.

   maxsize()
       Returns the size of the largest returned term (left side).

   lines()
       Returns the number of translation results.

   form()
       Returns the submitted form uri.

Name

       WWW::Dict::Leo::Org - Interface module to dictionary dict.leo.org

Options

new() has several parameters, which can be supplied as a hash.

       All parameters are optional.

       -Host
           The hostname of the dict website to use. For the moment only dict.leo.org is supported, which is also
           the default - therefore changing the hostname would not make much sense.

       -Port
           The tcp port to use for connecting, the default is 80, you shouldn't change it.

       -UserAgent
           The user-agent to send to dict.leo.org site. Currently this is the default:

            Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9

       -Proxy
           Fully  qualified  proxy  server.  Specify  as  you  would  do  in the well known environment variable
           http_proxy, example:

            -Proxy => "http://192.168.1.1:3128"

       -ProxyUser-ProxyPass
           If your proxy requires authentication, use these parameters to specify the credentials.

       -Debug
           If enabled (set to 1), prints a lot of debug  information  to  stderr,  normally  only  required  for
           developers or to report bugs (see below).

       Parameters to control behavior of dict.leo.org:

       -Language
           Translation direction. Please note that dict.leo.org always translates either to or from german.

           The following languages are supported: english, polish, spanish, portuguese russian and chinese.

           You  can   specify only the country  code, or append de2  in order to force translation to german, or
           preprend de2 in order to translate to the other language.

           Valid examples:

            ru     to or from russian
            de2pl  to polish
            es2de  spanish to german

           Valid country codes:

            en    english
            es    spanish
            fr    french
            ru    russian
            pt    portuguese
            pl    polish
            ch    chinese

           Default: en.

See Also

       leo

Synopsis

        use WWW::Dict::Leo::Org;
        my $leo = new WWW::Dict::Leo::Org();
        my @matches = $leo->translate($term);

Version

         2.01

perl v5.34.0                                       2022-06-04                                           Org(3pm)

See Also