NAME

Lingua::YALI::Identifier - Returns information about languages.

VERSION

version 0.003_01

SYNOPSIS

This modul is generalizatin of Lingua::YALI::LanguageIdentifier and can identify any document class based on used models.

METHODS

BUILD

Initializes internal variables.

add_class

$added = $identifier->add_class($label, $model)

Adds model stored in file $model with label $label and returns whether it was added or not.

my $identifier = Lingua::YALI::Identifier->new();
print $identifier->add_class("a", "model.a1.gz") . "\n"; 
// prints out 1
print $identifier->add_class("a", "model.a2.gz") . "\n";
// prints out 2 - class a was already added

remove_class

my $removed = $identifier->remove_class($class);

Removes model for label $label.

get_classes

my \@classes = $identifier->get_classes();
Returns all registered classes.

identify_file

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

Identifies class for file $file.

For more details look at method "identify_handle".

identify_string($string)

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

Identifies class for string $string.

For more details look at method "identify_handle".

identify_handle

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

Identifies class of file handler $fh. Returns reference to array of pairs with values [class, score] sorted descendently according to score, so the first result is the most probable one.

Returns [ ['lbl1', score1], ['lbl2', score2], ...]

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