| Server IP : 216.92.14.13 / Your IP : 216.73.216.171 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/bin/ |
Upload File : |
#!/usr/bin/perl
###########################################
# language-guess
# 2005, Mike Schilli <cpan@perlmeister.com>
###########################################
use strict;
use warnings;
use Getopt::Std;
use Pod::Usage;
use Log::Log4perl qw(:easy);
use Text::Language::Guess;
our $VERSION = "0.01";
getopts("hv", \my %opts);
pod2usage() if $opts{h};
if($opts{v}) {
die "$0 $VERSION\n";
}
if(! @ARGV) {
pod2usage("No file given");
}
Log::Log4perl->easy_init($ERROR);
my $guesser = Text::Language::Guess->new();
for my $file (@ARGV) {
my $lang = $guesser->language_guess($file);
print "$file: $lang\n";
}
__END__
=head1 NAME
language-guess - Guess the language of a text file
=head1 SYNOPSIS
language-guess file ...
=head1 OPTIONS
=over 8
=item B<-h>
Prints this manual page in text format.
=item B<-v>
Prints the current version of language-guess.
=back
=head1 DESCRIPTION
language-guess takes one or more file names as arguments and guesses
for each one which language it is written in. It uses
L<Text::Language::Guess>, please see its manual page for details.
=head1 EXAMPLES
$ language-guess bill.txt
=head1 LEGALESE
Copyright 2005 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 AUTHOR
2005, Mike Schilli <cpan@perlmeister.com>