Martin Majlis > Lingua-YALI-0.015 > Lingua::YALI::LanguageIdentifier

Download:
Lingua-YALI-0.015.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.015   Source  

NAME ^

Lingua::YALI::LanguageIdentifier - Module for language identification.

VERSION ^

version 0.015

SYNOPSIS ^

This modul is for language identification and can identify 122 languages.

    use Lingua::YALI::LanguageIdentifier;

    # create identifier and register languages
    my $identifier = Lingua::YALI::LanguageIdentifier->new();
    $identifier->add_language("ces", "eng")

    # identify string
    my $result = $identifier->identify_string("CPAN, the Comprehensive Perl Archive Network, is an archive of modules written in Perl.");
    print "The most probable language is " . $result->[0]->[0] . ".\n";
    # prints out The most probable language is eng.

More examples is presented in Lingua::YALI::Examples.

METHODS ^

add_language

    my $added_languages = $identifier->add_languages(@languages)

Registers new languages @languages for identification and returns the amount of newly added languages. Languages are identified by their ISO 639-3 code.

It croaks when unsupported language is used.

    print $identifier->add_languages("ces", "deu", "eng") . "\n";
    # prints out 3
    print $identifier->add_languages("ces", "slk") . "\n";
    # prints out 1

remove_language

    my $removed_languages = $identifier->remove_languages(@languages)

Remove languages @languages and returns the amount of removed languages.

It croaks when unsupported language is used.

    print $identifier->add_languages("ces", "deu", "eng")
    # prints out 3
    print $identifier->remove_languages("ces", "slk") . "\n";
    # prints out 1
    print $identifier->remove_languages("ces", "slk") . "\n";
    # prints out 0

get_languages

    my \@languages = $identifier->get_languages();

Returns all registered languages.

get_available_languages

    my \@languages = $identifier->get_available_languages();

Returns all available languages. Currently there is 122 languages ("LANGUAGES").

identify_file

    my $result = $identifier->identify_file($file)

Identifies language for file $file.

For more details look at method "identify_file" in Lingua::YALI::Identifier.

identify_string

    my $result = $identifier->identify_string($string)

Identifies language for string $string.

For more details look at method "identify_string" in Lingua::YALI::Identifier.

identify_handle

    my $result = $identifier->identify_handle($fh)

Identifies language for handle $fh.

For more details look at method "identify_handle" in Lingua::YALI::Identifier.

LANGUAGES ^

More details about supported languages may be found at http://ufal.mff.cuni.cz/~majlis/w2c/download.html.

SEE ALSO ^

AUTHOR ^

Martin Majlis <martin@majlis.cz>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2012 by Martin Majlis.

This is free software, licensed under:

  The (three-clause) BSD License
syntax highlighting: