SYNOPSIS
use Text::Beautify;
$text = "badly written text ,,you know ?"
$new_text = beautify($text);
# $new_text now holds "Badly written text, you know?"
# or
$text = Text::Beautify->new("badly written text ,,you know ?");
$new_text = $text->beautify;
# and also
enable_feature('repeated_punctuation'); # enables the feature
disable_feature('trailing_space'); # disables the feature
@features_enables = enabled_features();
@all_features = features();
enable_all();
disable_all();
DESCRIPTION
Beautifies text. This involves operations like squeezing double spaces, removing spaces from the beginning and end of lines, upper casing the first character in a string, etc.
You can enable / disable features with enable_feature / disable_feature. These commands return a true value if they are successful.
To know which features are beautified, see FEATURES
FEATURES
All features are enabled by default
heading_space
Removes heading spaces
trailing_space
Removes trailing spaces
double_spaces
Squeezes double spaces
repeated_punctuation
Squeezes repeated punctuation
space_in_front_of_punctuation
Removes spaces in front of punctuation
space_after_punctuation
Puts a spaces after punctuation
uppercase_first
Uppercases the first character in the string
METHODS
new
Creates a new Text::Beautify object
beautify
Applies all the enabled features
enabled_features
Returns a list with the enabled features
features
Returns a list containing all the features
enable_feature
Enables a feature
disable_feature
Disables a feature
enable_all
Enables all features
disable_all
Disables all features
TO DO
Allow the user to select the order in which features are applied
Allow creation of new features
BUGS
Each line is treated independently. This means a sentence comprising two lines will get it's second line's first character uppercased... must solve that ASAP.
Smiles such as "this :-(" are turned into "this:-("
AUTHOR
Jose Castro, <cog@cpan.org>
COPYRIGHT & LICENSE
Copyright 2004 Jose Castro, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.