Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (25 sloc) 813 Bytes
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use Lingua::EN::Fathom;
use File::Find::Rule;
my $path = shift || die "Usage: perl $0 /path/to/files";
my @files = File::Find::Rule->file()->name('*.txt')->in($path);
my $text = Lingua::EN::Fathom->new();
print "Chars\tWords\tComplex\tSentences\tSylW\tWpS\tFOG\tFlesch\tKincaid\tName\n";
for my $file ( @files ) {
$text->analyse_file($file);
my $basename = basename( $file, qw(.txt) );
printf "%d\t%d\t%.2f\t%d\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%s\n",
$text->num_chars,
$text->num_words,
$text->percent_complex_words,
$text->num_sentences,
$text->syllables_per_word,
$text->words_per_sentence,
$text->fog,
$text->flesch,
$text->kincaid,
$basename;
}