#!/usr/bin/perl ########################################### # language-guess # 2005, Mike Schilli ########################################### 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, 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