App::WIoZ - a perl word cloud generator
version 0.004
App::WIoZ can create a SVG or PNG image of a word cloud from a simple text file with word;weight.
word;weight
App::WIoZ is an acronym for "Words for Io by Zeus", look for the Correggio painting to watch the cloud.
App::WIoZ is based on Wordle strategy and yawc perl clone.
Wordle
yawc
Usage:
my $File = 'words.txt'; my $wioz = App::WIoZ->new( font_min => 18, font_max => 64, set_font => "DejaVuSans,normal,bold", filename => "testoutput", basecolor => '226666'); # violet if (-f $File) { my @words = $wioz->read_words($File); $wioz->do_layout(@words); } else { $wioz->chg_font("LiberationSans,normal,bold"); $wioz->update_colors('testoutput.sl.txt'); }
watch doc/freq.pl to create a words.txt file.
doc/freq.pl
words.txt
App::WIoZ is actually a POC to play with Moose, Cairo or Math::PlanePath.
The use of an Hilbert curve to manage free space is for playing with Math::PlanePath modules.
Performance can be improved in free space matching, or in spiral strategy to find free space.
Max and min font sizes can certainly be computed.
Feel free to clone this project on GitHub.
image height, default to 600
image width, default to 800
required min and max font size
accessors for font name, type and weight
set_font : set font in new WIoZ object, default is 'LiberationSans,normal,bold'
set_font
'LiberationSans,normal,bold'
chg_font : change font
chg_font
font : read font object
font
Usage :
$wioz = App::WIoZ->new( font_min => 18, font_max => 64, set_font => 'DejaVuSans,normal,bold'); $fontname = $wioz->font->{font}; $wioz->chg_font('LiberationSans,normal,bold');
file name output, extension .png or .svg will be added
.png
.svg
produce a svg output, default value
set to 0 to write a png
Scale for the Hilbert Curve granularity default to 10
Higer value produces better speed but more words recovery.
Base color for color theme, default to 882222
read words form file : word;weight
Usage: my @words = $wioz->read_words($File);
Read words position from file and update colors.
$wioz->update_colors("file.sl.txt");
Compute words position, save result to svg or png image, save in filename.sl.txt words positions to update colors.
filename.sl.txt
Usage : $wioz->do_layout(@words);
https://github.com/yvesago/WIoZ/
Yves Agostini, <yveago@cpan.org>
<yveago@cpan.org>
Copyright 2013 - Yves Agostini
This program is free software and may be modified or distributed under the same terms as Perl itself.
To install App::WIoZ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::WIoZ
CPAN shell
perl -MCPAN -e shell install App::WIoZ
For more information on module installation, please visit the detailed CPAN module installation guide.