Commit e291323f authored by Konstantin Narkhov's avatar Konstantin Narkhov

Version 0.1.2

1. Update README.md
parent b0d6d142
Pipeline #126832915 passed with stage
in 1 minute and 51 seconds
......@@ -2,7 +2,7 @@
"perl" : "6.c",
"name" : "LZW::Revolunet",
"authors" : [ "Konstantin Narkhov" ],
"version" : "0.1.1",
"version" : "0.1.2",
"description" : "Lempel–Ziv–Welch (LZW) algorithm implementation in Perl 6",
"license" : "Artistic-2.0",
"provides" : { "LZW::Revolunet" : "lib/LZW/Revolunet.pm6" },
......
# Lempel–Ziv–Welch (LZW) algorithm implementation in Perl 6
# Lempel–Ziv–Welch (LZW) algorithm implementation in Raku (formerly Perl 6)
## Synopsis
```perl
my $data = 'Тексты - это не энциклопедические и не лингвистические системы.' x 255;
my Int $r = 0;
my Str $d = 'Тексты - это не энциклопедические и не лингвистические системы.' x 255;
# create LWZ object with default dictionary size (57344)
my $lzw = LZW::Revolunet.new;
......@@ -12,23 +13,23 @@ my $lzw = LZW::Revolunet.new;
my $lzw = LZW::Revolunet.new( dictsize => 97000 );
# compress
my $cmp = $lzw.compress( $lzw.encode_utf8($data) );
my $cmp = $lzw.compress( $lzw.encode_utf8($d), :ratio($r) );
# decompress
my $dcmp = $lzw.decode_utf8( $lzw.decompress($cmp) );
# validate
if ( !($dcmp eq $data) ) {
if ( !($dcmp eq $d) ) {
die "decompressed data is corrupted";
}
# compress/decompress statistics
('compression ratio ' ~ floor($cmp.chars/$dcmp.chars*100) ~ '%').say;
('compression ratio ' ~ $r ~ '%').say;
```
## Description
**LZW::Revolunet**Perl6 implementation of universal lossless data compression [algorithm](https://en.wikipedia.org/wiki/Lzw) created by Abraham Lempel, Jacob Ziv, and Terry Welch. This module is based on JavaScript implementation ([lzw_encoder.js](https://gist.github.com/revolunet/843889)) by [Julien Bouquillon](https://github.com/revolunet)
**LZW::Revolunet**[Raku](https://raku.org) implementation of universal lossless data compression [algorithm](https://en.wikipedia.org/wiki/Lzw) created by Abraham Lempel, Jacob Ziv, and Terry Welch. This module is based on JavaScript implementation ([lzw_encoder.js](https://gist.github.com/revolunet/843889)) by [Julien Bouquillon](https://github.com/revolunet)
## License
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment