Lingua::Translit::Tables - provides transliteration tables


Lingua-Translit documentation Contained in the Lingua-Translit distribution.

Index


Code Index:

NAME

Top

Lingua::Translit::Tables - provides transliteration tables

SYNOPSIS

Top

  use Lingua::Translit::Tables qw/:checks/;

  my $truth;

  $truth = translit_supported("ISO 9");
  $truth = translit_reverse_supported("ISO 9");

  use Lingua::Translit::Tables qw/:list/;

  translit_list_supported();

DESCRIPTION

Top

This module is primary used to provide transliteration tables for Lingua::Translit and therefore allows to separate data and algorithm.

Beyond that, it provides routines to check if a given transliteration is supported and allows to print a simple list of supported transliterations along with some meta information.

EXPORTS

Top

No symbols are exported by default.

Use either the routine's name or one of the following tags to import symbols to your namespace.

all

Import all routines.

checks

Import all routines that allow to check if a given transliteration is supported: translit_supported() and translit_reverse_supported().

list

Import translit_list_supported(). (Convenience tag)

ROUTINES

Top

translit_supported(translit_name)

Returns true (1), iff translit_name is supported. False (0) otherwise.

translit_reverse_supported(translit_name)

Returns true (1), iff translit_name is supported and allows reverse transliteration. False (0) otherwise.

translit_list_supported()

Prints a list of all supported transliterations to STDOUT, providing the following information:

  * Name
  * Reversibility
  * Description

The same information is provided in this document as well:

SUPPORTED TRANSLITERATIONS

Top

Cyrillic

ALA-LC RUS, not reversible, ALA-LC:1997, Cyrillic to Latin, Russian

ISO 9, reversible, ISO 9:1995, Cyrillic to Latin

DIN 1460 RUS, reversible, DIN 1460:1982, Cyrillic to Latin, Russian

DIN 1460 UKR, reversible, DIN 1460:1982, Cyrillic to Latin, Ukrainian

DIN 1460 BUL, reversible, DIN 1460:1982, Cyrillic to Latin, Bulgarian

Streamlined System BUL, not reversible, The Streamlined System: 2006, Cyrillic to Latin, Bulgarian

GOST 7.79 RUS, reversible, GOST 7.79:2000 (table B), Cyrillic to Latin, Russian

GOST 7.79 RUS OLD, not reversible, GOST 7.79:2000 (table B), Cyrillic to Latin with support for Old Russian (pre 1918), Russian

GOST 7.79 UKR, reversible, GOST 7.79:2000 (table B), Cyrillic to Latin, Ukrainian

Greek

ISO 843, not reversible, ISO 843:1997, Greek to Latin

DIN 31634, not reversible, DIN 31634:1982, Greek to Latin

Greeklish, not reversible, Greeklish (Phonetic), Greek to Latin

Latin

Common CES, not reversible, Czech without diacritics

Common DEU, not reversible, German without umlauts

Common POL, not reversible, Unaccented Polish

Common RON, not reversible, Romanian without diacritics as commonly used

Common SLK, not reversible, Slovak without diacritics

Common SLV, not reversible, Slovenian without diacritics

Mongolian

Common Classical MON, reversible, Classical Mongolian to Latin

ADDING NEW TRANSLITERATIONS

Top

In case you want to add your own transliteration tables to Lingua::Translit, have a look at the developer manual included in the distribution. An online version is available at http://www.lingua-systems.com/downloads/Lingua-Translit/.

A template of a transliteration table is provided as well (xml/template.xml) so you can easily start developing.

BUGS

Top

None known.

Please report bugs to perl@lingua-systems.com.

SEE ALSO

Top

Lingua::Translit

http://www.lingua-systems.com/transliteration/Lingua-Translit-Perl-module/

CREDITS

Top

Thanks to Dr. Daniel Eiwen, Romanisches Seminar, Universitaet Koeln for his help on Romanian transliteration.

Thanks to Bayanzul Lodoysamba <baynaa@users.sourceforge.net> for contributing the "Common Classical Mongolian" transliteration table.

Thanks to Dmitry Smal and Rusar Publishing for contributing the "ALA-LC RUS" transliteration table.

AUTHORS

Top

Alex Linke <alinke@lingua-systems.com>

Rona Linke <rlinke@lingua-systems.com>

LICENSE AND COPYRIGHT

Top


Lingua-Translit documentation Contained in the Lingua-Translit distribution.
package Lingua::Translit::Tables;


#
# Copyright (C) 2007-2008 ...
#   Alex Linke <alinke@lingua-systems.com>
#   Rona Linke <rlinke@lingua-systems.com>
# Copyright (C) 2009-2011 Lingua-Systems Software GmbH
#


use strict;
use warnings;

require 5.008;


our $VERSION = '0.09';


use Carp;



require Exporter;

our @ISA        =   qw/Exporter/;
our @EXPORT     =   qw//;           # Export nothing by default
our @EXPORT_OK  =   qw/translit_supported translit_reverse_supported
                       translit_list_supported/;

our %EXPORT_TAGS = (
    checks  => [qw/translit_supported translit_reverse_supported/],
    list    => [qw/translit_list_supported/],
    all     => [@EXPORT_OK]
);


# For convenience, the tables are initialized at the bottom of this file
our %tables;


# used internally to retrieve a reference to a single transliteration table
sub _get_table_reference
{
    my $name = shift();

    return unless $name;

    $name = _get_table_id($name);

    foreach my $table (keys %tables)
    {
        return $tables{$table} if ($table =~ /^$name$/i);
    }

    return;
}


sub translit_supported
{
    return (_get_table_reference(_get_table_id($_[0])) ? 1 : 0);
}


sub translit_reverse_supported
{
    my $table = _get_table_reference(_get_table_id($_[0]));

    croak("Failed to retrieve table for $_[0].") unless ($table);

    return (($table->{reverse} =~ /^true$/) ? 1 : 0);
}


sub translit_list_supported
{
    foreach my $table (sort keys %tables)
    {
        my $t = $tables{$table};
        print "$t->{name}, ",
            ($t->{reverse} eq "false" ? "not " : ""),
            "reversible, $t->{desc}\n";
    }
}



# Get a table's identifier (based on the table's name)
#   i.e "Common DEU" -> "common_deu"
sub _get_table_id
{
    my $name = shift();

    return "" unless $name;

    $name =~ s/\s/_/g;

    return lc($name);
}


# For convenience, the next line is automatically substituted with the set
# of transliteration tables at build time.
%tables; # PLACEHOLDER


1;


# vim: sts=4 sw=4 ai et