Short description of Lingua::EN::Squeeze.pm module
NAME
Squeeze.pm - Shorten text to minimum syllables by using hash table
lookup and vowel deletion
SYNOPSIS
use Squeeze.pm; # import only function
use Squeeze qw( :ALL ); # import all functions and variables
use English; # to use readable variable names
while (<>)
{
print "Original: $ARG\n";
print "Squeezed: ", SqueezeText lc $ARG;
}
# Or you can use object oriented interface
$squeeze = new Lingua::EN::Squeeze;
while (<>)
{
print "Original: $ARG\n";
print "Squeezed: ", $squeeze->SqueezeText(lc $ARG);
}
DESCRIPTION
Squeeze English text to most compact format possible so that it is
barely readable. Be sure to convert all text to lowercase before
using the SqueezeText() for maximum compression, because
optimizations have been designed mostly for uncapitalized letters.
Warning: Each line is processed multiple times, so prepare for slow
conversion time'
You can use this module e.g. to preprocess text before it is sent
to electronic media that has some maximum text size limit. For
example pagers have an arbitrary text size limit, typically around
200 characters, which you want to fill as much as possible.
Alternatively you may have GSM cellular phone which is capable of
receiving Short Messages (SMS), whose message size limit is 160
characters. For demonstration of this module's SqueezeText()
function, this paragraph's conversion result is presented below.
See yourself if it's readable (Yes, it takes some time to get used
to). The compression ratio is typically 30-40%
u n use thi mod e.g. to prprce txt bfre is snt to
elrnic mda has som max txt siz lim. f_xmple pag
hv abitry txt siz lim, tpcly 200 chr, W/ u wnt
to fll as mch as psbleAlternatvly u may hv GSM cllar P8
w_s cpble of rcivng Short msg (SMS), WS/ msg siz
lim is 160 chr. 4 demonstrton of thi mods SquezText
fnc , dsc txt of thi prgra has ben cnvd_ blow
See uself if i_s redble (Yes, it tak som T to get usdto
compr rat is tpcly 30-40
And if $SQZ_OPTIMIZE_LEVEL is set to non-zero
u_nUseThiModE.g.ToPrprceTxtBfreI_sSntTo
elrnicMdaHasSomMaxTxtSizLim.F_xmplePag
hvAbitryTxtSizLim,Tpcly200Chr,W/UWnt
toFllAsMchAsPsbleAlternatvlyUMayHvGSMCllarP8
w_sCpbleOfRcivngShortMsg(SMS),WS/MsgSiz
limIs160Chr.4DemonstrtonOfThiModsSquezText
fnc,DscTxtOfThiPrgraHasBenCnvd_Blow
SeeUselfIfI_sRedble(Yes,ItTakSomTToGetUsdto
comprRatIsTpcly30-40
If you see following error during running test, please note,
that these are not coming from Squeeze.pm or from 't/test.t'. You
can verify this by running tests manually with 'perl t/test.t'.
foo@host$ perl .PL
foo@host$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/.t
t/test....Use of uninitialized value in concatenation (.) or string at (eval 9) line 3.
Use of uninitialized value in concatenation (.) or string at (eval 10) line 3.
Use of uninitialized value in concatenation (.) or string at (eval 10) line 3.
Use of uninitialized value in concatenation (.) or string at (eval 9) line 3.
t/test....ok 1/7Invalid conversion in sprintf: end of string at t/test.t line 62.
Use of uninitialized value in concatenation (.) or string at (eval 10) line 3.
Use of uninitialized value in concatenation (.) or string at (eval 9) line 3.
t/test....ok
All tests successful.
End