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

NAME

WWW::Translate::interNOSTRUM - Catalan < > Spanish machine translation [ OBSOLETE - Use WWW::Translate::Apertium instead ]

VERSION

Version 0.13 February 18, 2014

SYNOPSIS

    use WWW::Translate::interNOSTRUM;
    
    my $engine = WWW::Translate::interNOSTRUM->new();
    
    my $translated_string = $engine->translate($string);
    
    # default language pair is Catalan -> Spanish
    # change to Spanish -> Catalan:
    $engine->from_into('es-ca');
    
    # check current language pair:
    my $current_langpair = $engine->from_into();
    
    # default output format is 'plain_text'
    # change to 'marked_text':
    $engine->output_format('marked_text');
    
    # check current output format:
    my $current_format = $engine->output_format();
    
    # configure a new interNOSTRUM object to store unknown words:
    my $engine = WWW::Translate::interNOSTRUM->new(
                                                    output => 'marked_text',
                                                    store_unknown => 1,
                                                  );
    
    # get unknown words for source language = Spanish:
    my $es_unknown_href = $engine->get_unknown('es');

DESCRIPTION

[ OBSOLETE MODULE: interNOSTRUM will cease to be available on 31.05.2014, but interNOSTRUM technologies continue and expand in the free/open-source platform Apertium (accessible through WWW::Translate::Apertium). ]

interNOSTRUM is a Catalan < > Spanish machine translation engine developed by the Department of Software and Computing Systems of the University of Alicante in Spain. This module provides an OO interface to the interNOSTRUM online translation engine.

interNOSTRUM provides approximate translations of Catalan into Spanish and Spanish into Catalan. It generates both the central variant of Oriental Catalan (the standard variant used in Catalonia) and Valencian forms, which follow the recommendations published in http://www.ua.es/spv/assessorament/criteris.pdf. For more information on the Catalan variants, see the References below.

CONSTRUCTOR

new()

Creates and returns a new WWW::Translate::interNOSTRUM object.

    my $engine = WWW::Translate::interNOSTRUM->new();

WWW::Translate::interNOSTRUM recognizes the following parameters:

  • lang_pair

    The valid values of this parameter are:

    • ca-es

      Standard Catalan or Valencian into Spanish (default value).

    • es-ca

      Spanish into Standard Catalan.

    • es-va

      Spanish into Valencian.

  • output

    The valid values of this parameter are:

    • plain_text

      Returns the translation as plain text (default value).

    • marked_text

      Returns the translation with the unknown words marked with an asterisk.

  • store_unknown

    Off by default. If set to a true value, it configures the engine object to store in a hash the unknown words and their frequencies during the session. You will be able to access this hash later through the get_unknown method. If you change the engine language pair in the same session, it will also create a separate word list for the new source language.

    IMPORTANT: If you activate this setting, then you must also set the output parameter to marked_text. Otherwise, the get_unknown method will return an empty hash.

The default parameter values can be overridden when creating a new interNOSTRUM engine object:

    my %options = (
                    lang_pair => 'es-ca',
                    output => 'marked_text',
                    store_unknown => 1,
                  );

    my $engine = WWW::Translate::interNOSTRUM->new(%options);

METHODS

$engine->translate($string)

Returns the translation of $string generated by interNOSTRUM. $string must be a string of ANSI text, and can contain up to 16,384 characters. If the source text isn't encoded as Latin-1, you must convert it to that encoding before sending it to the machine translation engine. For this task you can use the Encode module or the PerlIO layer, if you are reading the text from a file.

In case the server is down, it will show a warning and return undef.

$engine->from_into($lang_pair)

Changes the engine language pair to $lang_pair. When called with no argument, it returns the value of the current engine language pair.

$engine->output_format($format)

Changes the engine output format to $format. When called with no argument, it returns the value of the current engine output format.

$engine->get_unknown($lang_code)

If the engine was configured to store unknown words, it returns a reference to a hash containing the unknown words (keys) detected during the current machine translation session for the specified source language, along with their frequencies (values).

The valid values of $lang_code are:

  • ca

    Source language is Catalan or Valencian.

  • es

    Source language is Spanish.

DEPENDENCIES

WWW::Mechanize 1.20 or higher.

SEE ALSO

WWW::Translate::Apertium

REFERENCES

interNOSTRUM website:

http://www.internostrum.com/welcome.php

Department of Software and Computing Systems (University of Alicante):

http://www.dlsi.ua.es/index.cgi?id=eng

For more information on Catalan and its variants, see:

http://en.wikipedia.org/wiki/Catalan_language

ACKNOWLEDGEMENTS

Many thanks to Mikel Forcada Zubizarreta, coordinator of the interNOSTRUM project, who kindly answered my questions during the development of this module.

AUTHOR

Enrique Nell, <blas.gordon at gmail.com>

BUGS

Please report any bugs or feature requests to bug-www-translate-internostrum at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Translate-interNOSTRUM. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::Translate::interNOSTRUM

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2006-2014 Enrique Nell.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.