NAME

Text::Pangram - utilities to find English pangrams

VERSION

Version 0.01

SYNOPSIS

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"; }

DESCRIPTION

A pangram is a text that contains every letter of the alphabet. This module provides utilities for identifying pangrams.

$pangram->new

Constructor. Receives the text that will be analyzed.

$pangram->is_pangram

Returns true if the supplied text is a pangram.

$pangram->find_pangram_window

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->window_length

The length of the shortest pangrammatic window.

$pangram->window

The pangrammatic window from the original text.

$pangram->stripped_window

The stripped text of the pangrammatic window. (That is, with all nonalphabetic characters stripped out.)

AUTHOR

Jesse Sheidlower <jester@panix.com>

BUGS

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.

TODO

Extend to handle non-English text, other alphabets, etc.

ACKNOWLEDGEMENTS

Thanks to Adam Turoff, Ben Rosengart, and Perrin Harkins for help and suggestions.

COPYRIGHT AND LICENSE

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.