Lingua-RU-Detect
view release on metacpan or search on metacpan
lib/Lingua/RU/Detect.pm view on Meta::CPAN
$path = remove_ambiguity($path, $string) if $path =~ m{\|};
return make_list($path);
}
sub remove_ambiguity {
my $paths = shift;
my $text = shift;
my @paths = split m{\|}, $paths;
my %stats = ();
for my $path (@paths) {
$stats{$path} = () = $text =~ /$ambiguities{$path}/g;
}
return scalar keys %stats ? (sort {$stats{$a} <=> $stats{$b}} keys %stats)[-1] : $paths[0];
}
sub make_list {
my $path = shift;
( run in 1.652 second using v1.01-cache-2.11-cpan-71847e10f99 )