The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

SYNOPSIS

use Search::Elasticsearch;
use Search::Elasticsearch::Plugin::Langdetect;

use Search::Elasticsearch();
my $es = Search::Elasticsearch->new(
    nodes   => \@nodes,
    plugins => ['Langdetect']
);

my $e = Search::Elasticsearch->new(...);
my $ld = $e->langdetect;

my $lang = $ld->detect_language( "Hello World" );
# en

METHODS

->detect_languages $content

my $languages = $ld->detect_languages( $content );

Returns an arrayref of all detected languages together with their propabilities.

->detect_language $content

my $language = $ld->detect_language( $content );

Returns the ISO-two-letter code for the detected language. This method is mostly a shorthand for retrieving the most likely language from ->detect_languages.

-=cut