Text::Pangram - utilities to find English pangrams
Version 0.01
use Text::Pangram;
my $text = "The quick brown fox jumps over the lazy dog."; my $pangram = Text::Pangram->new( $text );
print "Pangram!\n" if $pangram->is_pangram;
if ($pangram->find_pangram_window) { print "Smallest window is " . $pangram->window_length " characters:\n"; print $pangram->window . "\n"; } else { print "Not a pangram!\n"; }
A pangram is a text that contains every letter of the alphabet. This module provides utilities for identifying pangrams.
Constructor. Receives the text that will be analyzed.
Returns true if the supplied text is a pangram.
Finds the shortest "pangrammatic window" in a text: the shortest span of text that contains a pangram. It is designed to be fast when scanning large texts.
The method will return false if the text does not contain a pangram at all. If the text is pangrammatic, $pangram will allow you to access three pieces of data:
$pangram
The length of the shortest pangrammatic window.
The pangrammatic window from the original text.
The stripped text of the pangrammatic window. (That is, with all nonalphabetic characters stripped out.)
Jesse Sheidlower <jester@panix.com>
<jester@panix.com>
Please report any bugs or feature requests to bug-text-pangram at rt.cpan.org , or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-Pangram. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-text-pangram at rt.cpan.org
Extend to handle non-English text, other alphabets, etc.
Thanks to Adam Turoff, Ben Rosengart, and Perrin Harkins for help and suggestions.
Copyright (c) 2014 Jesse Sheidlower.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Text::Pangram, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Pangram
CPAN shell
perl -MCPAN -e shell install Text::Pangram
For more information on module installation, please visit the detailed CPAN module installation guide.