<s>
Lempel	B-Algorithm
–	I-Algorithm
Ziv	I-Algorithm
–	I-Algorithm
Welch	I-Algorithm
(	O
LZW	B-Algorithm
)	O
is	O
a	O
universal	O
lossless	B-Algorithm
data	I-Algorithm
compression	I-Algorithm
algorithm	O
created	O
by	O
Abraham	O
Lempel	O
,	O
Jacob	O
Ziv	O
,	O
and	O
Terry	O
Welch	O
.	O
</s>
<s>
It	O
was	O
published	O
by	O
Welch	O
in	O
1984	O
as	O
an	O
improved	O
implementation	O
of	O
the	O
LZ78	B-Algorithm
algorithm	O
published	O
by	O
Lempel	O
and	O
Ziv	O
in	O
1978	O
.	O
</s>
<s>
It	O
is	O
the	O
algorithm	O
of	O
the	O
Unix	B-Application
file	O
compression	O
utility	O
compress	B-Device
and	O
is	O
used	O
in	O
the	O
GIF	O
image	O
format	O
.	O
</s>
<s>
The	O
codes	O
from	O
0	O
to	O
255	O
represent	O
1-character	O
sequences	O
consisting	O
of	O
the	O
corresponding	O
8-bit	O
character	O
,	O
and	O
the	O
codes	O
256	O
through	O
4095	O
are	O
created	O
in	O
a	O
dictionary	B-Algorithm
for	O
sequences	O
encountered	O
in	O
the	O
data	O
as	O
it	O
is	O
encoded	O
.	O
</s>
<s>
At	O
each	O
stage	O
in	O
compression	O
,	O
input	O
bytes	O
are	O
gathered	O
into	O
a	O
sequence	O
until	O
the	O
next	O
character	O
would	O
make	O
a	O
sequence	O
with	O
no	O
code	O
yet	O
in	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
The	O
code	O
for	O
the	O
sequence	O
(	O
without	O
that	O
character	O
)	O
is	O
added	O
to	O
the	O
output	O
,	O
and	O
a	O
new	O
code	O
(	O
for	O
the	O
sequence	O
with	O
that	O
character	O
)	O
is	O
added	O
to	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
It	O
is	O
critical	O
that	O
the	O
encoder	O
and	O
decoder	O
agree	O
on	O
the	O
variety	O
of	O
LZW	B-Algorithm
used	O
:	O
the	O
size	O
of	O
the	O
alphabet	O
,	O
the	O
maximum	O
table	O
size	O
(	O
and	O
code	O
width	O
)	O
,	O
whether	O
variable-width	O
encoding	O
is	O
used	O
,	O
initial	O
code	O
size	O
,	O
and	O
whether	O
to	O
use	O
the	O
clear	O
and	O
stop	O
codes	O
(	O
and	O
what	O
values	O
they	O
have	O
)	O
.	O
</s>
<s>
Most	O
formats	O
that	O
employ	O
LZW	B-Algorithm
build	O
this	O
information	O
into	O
the	O
format	O
specification	O
or	O
provide	O
explicit	O
fields	O
for	O
them	O
in	O
a	O
compression	O
header	O
for	O
the	O
data	O
.	O
</s>
<s>
Initialize	O
the	O
dictionary	B-Algorithm
to	O
contain	O
all	O
strings	O
of	O
length	O
one	O
.	O
</s>
<s>
Find	O
the	O
longest	O
string	O
W	O
in	O
the	O
dictionary	B-Algorithm
that	O
matches	O
the	O
current	O
input	O
.	O
</s>
<s>
Emit	O
the	O
dictionary	B-Algorithm
index	O
for	O
W	O
to	O
output	O
and	O
remove	O
W	O
from	O
the	O
input	O
.	O
</s>
<s>
Add	O
W	O
followed	O
by	O
the	O
next	O
symbol	O
in	O
the	O
input	O
to	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
A	O
dictionary	B-Algorithm
is	O
initialized	O
to	O
contain	O
the	O
single-character	O
strings	O
corresponding	O
to	O
all	O
the	O
possible	O
input	O
characters	O
(	O
and	O
nothing	O
else	O
except	O
the	O
clear	O
and	O
stop	O
codes	O
if	O
they	O
're	O
being	O
used	O
)	O
.	O
</s>
<s>
The	O
algorithm	O
works	O
by	O
scanning	O
through	O
the	O
input	O
string	O
for	O
successively	O
longer	O
substrings	O
until	O
it	O
finds	O
one	O
that	O
is	O
not	O
in	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
When	O
such	O
a	O
string	O
is	O
found	O
,	O
the	O
index	O
for	O
the	O
string	O
without	O
the	O
last	O
character	O
(	O
i.e.	O
,	O
the	O
longest	O
substring	O
that	O
is	O
in	O
the	O
dictionary	B-Algorithm
)	O
is	O
retrieved	O
from	O
the	O
dictionary	B-Algorithm
and	O
sent	O
to	O
output	O
,	O
and	O
the	O
new	O
string	O
(	O
including	O
the	O
last	O
character	O
)	O
is	O
added	O
to	O
the	O
dictionary	B-Algorithm
with	O
the	O
next	O
available	O
code	O
.	O
</s>
<s>
In	O
this	O
way	O
,	O
successively	O
longer	O
strings	O
are	O
registered	O
in	O
the	O
dictionary	B-Algorithm
and	O
available	O
for	O
subsequent	O
encoding	O
as	O
single	O
output	O
values	O
.	O
</s>
<s>
As	O
the	O
message	O
grows	O
,	O
however	O
,	O
the	O
compression	B-General_Concept
ratio	I-General_Concept
tends	O
asymptotically	O
to	O
the	O
maximum	O
(	O
i.e.	O
,	O
the	O
compression	O
factor	O
or	O
ratio	O
improves	O
on	O
an	O
increasing	O
curve	O
,	O
and	O
not	O
linearly	O
,	O
approaching	O
a	O
theoretical	O
maximum	O
inside	O
a	O
limited	O
time	O
period	O
rather	O
than	O
over	O
infinite	O
time	O
)	O
.	O
</s>
<s>
Initialize	O
the	O
dictionary	B-Algorithm
to	O
contain	O
all	O
strings	O
of	O
length	O
one	O
.	O
</s>
<s>
Read	O
the	O
next	O
encoded	O
symbol	O
:	O
Is	O
it	O
encoded	O
in	O
the	O
dictionary	B-Algorithm
?	O
</s>
<s>
Concatenate	O
the	O
previous	O
string	O
emitted	O
to	O
output	O
with	O
the	O
first	O
symbol	O
of	O
W	O
.	O
Add	O
this	O
to	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
Add	O
V	O
to	O
the	O
dictionary	B-Algorithm
and	O
emit	O
V	O
to	O
output	O
.	O
</s>
<s>
The	O
decoding	O
algorithm	O
works	O
by	O
reading	O
a	O
value	O
from	O
the	O
encoded	O
input	O
and	O
outputting	O
the	O
corresponding	O
string	O
from	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
However	O
,	O
the	O
full	O
dictionary	B-Algorithm
is	O
not	O
needed	O
,	O
only	O
the	O
initial	O
dictionary	B-Algorithm
that	O
contains	O
single-character	O
strings	O
(	O
and	O
that	O
is	O
usually	O
hard	O
coded	O
in	O
the	O
program	O
,	O
instead	O
of	O
sent	O
with	O
the	O
encoded	O
data	O
)	O
.	O
</s>
<s>
Instead	O
,	O
the	O
full	O
dictionary	B-Algorithm
is	O
rebuilt	O
during	O
the	O
decoding	O
process	O
the	O
following	O
way	O
:	O
after	O
decoding	O
a	O
value	O
and	O
outputting	O
a	O
string	O
,	O
the	O
decoder	O
concatenates	O
it	O
with	O
the	O
first	O
character	O
of	O
the	O
next	O
decoded	O
string	O
(	O
or	O
the	O
first	O
character	O
of	O
current	O
string	O
,	O
if	O
the	O
next	O
one	O
ca	O
n't	O
be	O
decoded	O
;	O
since	O
if	O
the	O
next	O
value	O
is	O
unknown	O
,	O
then	O
it	O
must	O
be	O
the	O
value	O
added	O
to	O
the	O
dictionary	B-Algorithm
in	O
this	O
iteration	O
,	O
and	O
so	O
its	O
first	O
character	O
is	O
the	O
same	O
as	O
the	O
first	O
character	O
of	O
the	O
current	O
string	O
)	O
,	O
and	O
updates	O
the	O
dictionary	B-Algorithm
with	O
the	O
new	O
string	O
.	O
</s>
<s>
This	O
is	O
called	O
"	O
early	O
change	O
"	O
;	O
it	O
caused	O
so	O
much	O
confusion	O
that	O
Adobe	O
now	O
allows	O
both	O
versions	O
in	O
PDF	B-Application
files	I-Application
,	O
but	O
includes	O
an	O
explicit	O
flag	O
in	O
the	O
header	O
of	O
each	O
LZW-compressed	O
stream	O
to	O
indicate	O
whether	O
early	O
change	O
is	O
being	O
used	O
.	O
</s>
<s>
Of	O
the	O
graphics	O
file	O
formats	O
that	O
support	O
LZW	B-Algorithm
compression	I-Algorithm
,	O
TIFF	O
uses	O
early	O
change	O
,	O
while	O
GIF	O
and	O
most	O
others	O
do	O
n't	O
.	O
</s>
<s>
TIFF	O
files	O
and	O
PDF	B-Application
files	I-Application
use	O
MSB-first	O
packing	O
order	O
.	O
</s>
<s>
The	O
following	O
example	O
illustrates	O
the	O
LZW	B-Algorithm
algorithm	I-Algorithm
in	O
action	O
,	O
showing	O
the	O
status	O
of	O
the	O
output	O
and	O
the	O
dictionary	B-Algorithm
at	O
every	O
stage	O
,	O
both	O
in	O
encoding	O
and	O
decoding	O
the	O
data	O
.	O
</s>
<s>
There	O
are	O
thus	O
26	O
symbols	O
in	O
the	O
plaintext	O
alphabet	O
(	O
the	O
26	O
capital	O
letters	O
A	O
through	O
Z	B-Device
)	O
,	O
and	O
the	O
#	O
character	O
represents	O
a	O
stop	O
code	O
.	O
</s>
<s>
(	O
Most	O
flavors	O
of	O
LZW	B-Algorithm
would	O
put	O
the	O
stop	O
code	O
after	O
the	O
data	O
alphabet	O
,	O
but	O
nothing	O
in	O
the	O
basic	O
algorithm	O
requires	O
that	O
.	O
</s>
<s>
The	O
dictionary	B-Algorithm
is	O
initialized	O
with	O
these	O
27	O
values	O
.	O
</s>
<s>
As	O
the	O
dictionary	B-Algorithm
grows	O
,	O
the	O
codes	O
must	O
grow	O
in	O
width	O
to	O
accommodate	O
the	O
additional	O
entries	O
.	O
</s>
<s>
A	O
5-bit	O
code	O
gives	O
25	O
=	O
32	O
possible	O
combinations	O
of	O
bits	O
,	O
so	O
when	O
the	O
33rd	O
dictionary	B-Algorithm
word	O
is	O
created	O
,	O
the	O
algorithm	O
must	O
switch	O
at	O
that	O
point	O
from	O
5-bit	O
strings	O
to	O
6-bit	O
strings	O
(	O
for	O
all	O
code	O
values	O
,	O
including	O
those	O
previously	O
output	O
with	O
only	O
five	O
bits	O
)	O
.	O
</s>
<s>
Note	O
that	O
since	O
the	O
all-zero	O
code	O
00000	O
is	O
used	O
,	O
and	O
is	O
labeled	O
"	O
0	O
"	O
,	O
the	O
33rd	O
dictionary	B-Algorithm
entry	O
is	O
labeled	O
32	O
.	O
</s>
<s>
(	O
Previously	O
generated	O
output	O
is	O
not	O
affected	O
by	O
the	O
code-width	O
change	O
,	O
but	O
once	O
a	O
6-bit	O
value	O
is	O
generated	O
in	O
the	O
dictionary	B-Algorithm
,	O
it	O
could	O
conceivably	O
be	O
the	O
next	O
code	O
emitted	O
,	O
so	O
the	O
width	O
for	O
subsequent	O
output	O
shifts	O
to	O
6	O
bits	O
to	O
accommodate	O
that	O
.	O
)	O
</s>
<s>
The	O
initial	O
dictionary	B-Algorithm
,	O
then	O
,	O
consists	O
of	O
the	O
following	O
entries	O
:	O
</s>
<s>
Buffer	O
input	O
characters	O
in	O
a	O
sequence	O
ω	O
until	O
ω	O
+	O
next	O
character	O
is	O
not	O
in	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
Emit	O
the	O
code	O
for	O
ω	O
,	O
and	O
add	O
ω	O
+	O
next	O
character	O
to	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
Using	O
LZW	B-Algorithm
has	O
saved	O
29	O
bits	O
out	O
of	O
125	O
,	O
reducing	O
the	O
message	O
by	O
more	O
than	O
23%	O
.	O
</s>
<s>
If	O
the	O
message	O
were	O
longer	O
,	O
then	O
the	O
dictionary	B-Algorithm
words	O
would	O
begin	O
to	O
represent	O
longer	O
and	O
longer	O
sections	O
of	O
text	O
,	O
sending	O
repeated	O
words	O
very	O
compactly	O
.	O
</s>
<s>
To	O
decode	O
an	O
LZW-compressed	O
archive	O
,	O
one	O
needs	O
to	O
know	O
in	O
advance	O
the	O
initial	O
dictionary	B-Algorithm
used	O
,	O
but	O
additional	O
entries	O
can	O
be	O
reconstructed	O
as	O
they	O
are	O
always	O
simply	O
concatenations	O
of	O
previous	O
entries	O
.	O
</s>
<s>
Input	O
Output	O
Sequence	O
New	O
Dictionary	B-Algorithm
Entry	O
Comments	O
Bits	O
Code	O
Full	O
Conjecture	O
10100	O
20	O
T	O
27	O
:	O
T	O
?	O
</s>
<s>
It	O
is	O
the	O
first	O
letter	O
in	O
the	O
sequence	O
coded	O
by	O
the	O
next	O
code	O
Z	B-Device
that	O
the	O
decoder	O
receives	O
.	O
</s>
<s>
So	O
the	O
decoder	O
looks	O
up	O
Z	B-Device
,	O
decodes	O
it	O
into	O
the	O
sequence	O
ω	O
and	O
takes	O
the	O
first	O
letter	O
z	B-Device
and	O
tacks	O
it	O
onto	O
the	O
end	O
of	O
χ	O
as	O
the	O
next	O
dictionary	B-Algorithm
entry	O
.	O
</s>
<s>
This	O
works	O
as	O
long	O
as	O
the	O
codes	O
received	O
are	O
in	O
the	O
decoder	O
's	O
dictionary	B-Algorithm
,	O
so	O
that	O
they	O
can	O
be	O
decoded	O
into	O
sequences	O
.	O
</s>
<s>
What	O
happens	O
if	O
the	O
decoder	O
receives	O
a	O
code	O
Z	B-Device
that	O
is	O
not	O
yet	O
in	O
its	O
dictionary	B-Algorithm
?	O
</s>
<s>
Since	O
the	O
decoder	O
is	O
always	O
just	O
one	O
code	O
behind	O
the	O
encoder	O
,	O
Z	B-Device
can	O
be	O
in	O
the	O
encoder	O
's	O
dictionary	B-Algorithm
only	O
if	O
the	O
encoder	O
just	O
generated	O
it	O
,	O
when	O
emitting	O
the	O
previous	O
code	O
X	O
for	O
χ	O
.	O
</s>
<s>
Thus	O
Z	B-Device
codes	O
some	O
ω	O
that	O
is	O
χ	O
+	O
?,	O
and	O
the	O
decoder	O
can	O
determine	O
the	O
unknown	O
character	O
as	O
follows	O
:	O
</s>
<s>
The	O
decoder	O
sees	O
X	O
and	O
then	O
Z	B-Device
,	O
where	O
X	O
codes	O
the	O
sequence	O
χ	O
and	O
Z	B-Device
codes	O
some	O
unknown	O
sequence	O
ω	O
.	O
</s>
<s>
The	O
decoder	O
knows	O
that	O
the	O
encoder	O
just	O
added	O
Z	B-Device
as	O
a	O
code	O
for	O
χ	O
+	O
some	O
unknown	O
character	O
c	O
,	O
so	O
ω	O
=	O
χ	O
+	O
c	O
.	O
</s>
<s>
So	O
even	O
though	O
the	O
Z	B-Device
code	O
is	O
not	O
in	O
the	O
table	O
,	O
the	O
decoder	O
is	O
able	O
to	O
infer	O
the	O
unknown	O
sequence	O
and	O
adds	O
χ	O
+	O
(	O
the	O
first	O
character	O
of	O
χ	O
)	O
to	O
the	O
table	O
as	O
the	O
value	O
of	O
Z	B-Device
.	O
</s>
<s>
This	O
situation	O
occurs	O
whenever	O
the	O
encoder	O
encounters	O
input	O
of	O
the	O
form	O
cScSc	O
,	O
where	O
c	O
is	O
a	O
single	O
character	O
,	O
S	O
is	O
a	O
string	O
and	O
cS	O
is	O
already	O
in	O
the	O
dictionary	B-Algorithm
,	O
but	O
cSc	O
is	O
not	O
.	O
</s>
<s>
The	O
encoder	O
emits	O
the	O
code	O
for	O
cS	O
,	O
putting	O
a	O
new	O
code	O
for	O
cSc	O
into	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
The	O
argument	O
above	O
shows	O
that	O
whenever	O
the	O
decoder	O
receives	O
a	O
code	O
not	O
in	O
its	O
dictionary	B-Algorithm
,	O
the	O
situation	O
must	O
look	O
like	O
this	O
.	O
</s>
<s>
In	O
particular	O
,	O
long	O
strings	O
of	O
a	O
single	O
character	O
(	O
which	O
are	O
common	O
in	O
the	O
kinds	O
of	O
images	O
LZW	B-Algorithm
is	O
often	O
used	O
to	O
encode	O
)	O
repeatedly	O
generate	O
patterns	O
of	O
this	O
sort	O
.	O
</s>
<s>
The	O
simple	O
scheme	O
described	O
above	O
focuses	O
on	O
the	O
LZW	B-Algorithm
algorithm	I-Algorithm
itself	O
.	O
</s>
<s>
A	O
standard	O
entropy	O
encoding	O
such	O
as	O
Huffman	B-General_Concept
coding	I-General_Concept
or	O
arithmetic	B-Algorithm
coding	I-Algorithm
then	O
uses	O
shorter	O
codes	O
for	O
values	O
with	O
higher	O
probabilities	O
.	O
</s>
<s>
LZW	B-Algorithm
compression	I-Algorithm
became	O
the	O
first	O
widely	O
used	O
universal	O
data	O
compression	O
method	O
on	O
computers	O
.	O
</s>
<s>
A	O
large	O
English	O
text	O
file	O
can	O
typically	O
be	O
compressed	O
via	O
LZW	B-Algorithm
to	O
about	O
half	O
its	O
original	O
size	O
.	O
</s>
<s>
LZW	B-Algorithm
was	O
used	O
in	O
the	O
public-domain	O
program	O
compress	B-Device
,	O
which	O
became	O
a	O
more	O
or	O
less	O
standard	O
utility	O
in	O
Unix	B-Application
systems	I-Application
around	O
1986	O
.	O
</s>
<s>
It	O
has	O
since	O
disappeared	O
from	O
many	O
distributions	O
,	O
both	O
because	O
it	O
infringed	O
the	O
LZW	B-Algorithm
patent	O
and	O
because	O
gzip	B-Application
produced	O
better	O
compression	O
ratios	O
using	O
the	O
LZ77-based	O
DEFLATE	B-Algorithm
algorithm	O
,	O
but	O
as	O
of	O
2008	O
at	O
least	O
FreeBSD	O
includes	O
both	O
compress	B-Device
and	O
uncompress	B-Device
as	O
a	O
part	O
of	O
the	O
distribution	O
.	O
</s>
<s>
Several	O
other	O
popular	O
compression	O
utilities	O
also	O
used	O
LZW	B-Algorithm
or	O
closely	O
related	O
methods	O
.	O
</s>
<s>
LZW	B-Algorithm
became	O
very	O
widely	O
used	O
when	O
it	O
became	O
part	O
of	O
the	O
GIF	O
image	O
format	O
in	O
1987	O
.	O
</s>
<s>
It	O
may	O
also	O
(	O
optionally	O
)	O
be	O
used	O
in	O
TIFF	O
and	O
PDF	B-Application
files	I-Application
.	O
</s>
<s>
(	O
Although	O
LZW	B-Algorithm
is	O
available	O
in	O
Adobe	B-Application
Acrobat	I-Application
software	O
,	O
Acrobat	O
by	O
default	O
uses	O
DEFLATE	B-Algorithm
for	O
most	O
text	O
and	O
color-table-based	O
image	O
data	O
in	O
PDF	B-Application
files	I-Application
.	O
)	O
</s>
<s>
Various	O
patents	O
have	O
been	O
issued	O
in	O
the	O
United	O
States	O
and	O
other	O
countries	O
for	O
LZW	B-Algorithm
and	O
similar	O
algorithms	O
.	O
</s>
<s>
LZ78	B-Algorithm
was	O
covered	O
by	O
by	O
Lempel	O
,	O
Ziv	O
,	O
Cohn	O
,	O
and	O
Eastman	O
,	O
assigned	O
to	O
Sperry	O
Corporation	O
,	O
later	O
Unisys	O
Corporation	O
,	O
filed	O
on	O
August	O
10	O
,	O
1981	O
.	O
</s>
<s>
Two	O
US	O
patents	O
were	O
issued	O
for	O
the	O
LZW	B-Algorithm
algorithm	I-Algorithm
:	O
by	O
Victor	O
S	O
.	O
Miller	O
and	O
Mark	O
N	O
.	O
Wegman	O
and	O
assigned	O
to	O
IBM	O
,	O
originally	O
filed	O
on	O
June	O
1	O
,	O
1983	O
,	O
and	O
by	O
Welch	O
,	O
assigned	O
to	O
Sperry	O
Corporation	O
,	O
later	O
Unisys	O
Corporation	O
,	O
filed	O
on	O
June	O
20	O
,	O
1983	O
.	O
</s>
<s>
In	O
1993	O
–	O
94	O
,	O
and	O
again	O
in	O
1999	O
,	O
Unisys	O
Corporation	O
received	O
widespread	O
condemnation	O
when	O
it	O
attempted	O
to	O
enforce	O
licensing	O
fees	O
for	O
LZW	B-Algorithm
in	O
GIF	O
images	O
.	O
</s>
<s>
The	O
1993	O
–	O
1994	O
Unisys-CompuServe	O
controversy	O
(	O
CompuServe	O
being	O
the	O
creator	O
of	O
the	O
GIF	O
format	O
)	O
prompted	O
a	O
Usenet	B-Application
comp.graphics	O
discussion	O
Thoughts	O
on	O
a	O
GIF-replacement	O
file	O
format	O
,	O
which	O
in	O
turn	O
fostered	O
an	O
email	O
exchange	O
that	O
eventually	O
culminated	O
in	O
the	O
creation	O
of	O
the	O
patent-unencumbered	O
Portable	O
Network	O
Graphics	O
(	O
PNG	O
)	O
file	O
format	O
in	O
1995	O
.	O
</s>
<s>
Unisys	O
's	O
US	O
patent	O
on	O
the	O
LZW	B-Algorithm
algorithm	I-Algorithm
expired	O
on	O
June	O
20	O
,	O
2003	O
,	O
20	O
years	O
after	O
it	O
had	O
been	O
filed	O
.	O
</s>
<s>
LZMW	O
(	O
1985	O
,	O
by	O
V	O
.	O
Miller	O
,	O
M	O
.	O
Wegman	O
)	O
–	O
Searches	O
input	O
for	O
the	O
longest	O
string	O
already	O
in	O
the	O
dictionary	B-Algorithm
(	O
the	O
"	O
current	O
"	O
match	O
)	O
;	O
adds	O
the	O
concatenation	O
of	O
the	O
previous	O
match	O
with	O
the	O
current	O
match	O
to	O
the	O
dictionary	B-Algorithm
.	O
</s>
<s>
(	O
Dictionary	B-Algorithm
entries	O
thus	O
grow	O
more	O
rapidly	O
;	O
but	O
this	O
scheme	O
is	O
much	O
more	O
complicated	O
to	O
implement	O
.	O
)	O
</s>
<s>
Miller	O
and	O
Wegman	O
also	O
suggest	O
deleting	O
low-frequency	O
entries	O
from	O
the	O
dictionary	B-Algorithm
when	O
the	O
dictionary	B-Algorithm
fills	O
up	O
.	O
</s>
<s>
LZAP	O
(	O
1988	O
,	O
by	O
James	O
Storer	O
)	O
–	O
modification	O
of	O
LZMW	O
:	O
instead	O
of	O
adding	O
just	O
the	O
concatenation	O
of	O
the	O
previous	O
match	O
with	O
the	O
current	O
match	O
to	O
the	O
dictionary	B-Algorithm
,	O
add	O
the	O
concatenations	O
of	O
the	O
previous	O
match	O
with	O
each	O
initial	O
substring	O
of	O
the	O
current	O
match	O
(	O
"	O
AP	O
"	O
stands	O
for	O
"	O
all	O
prefixes	O
"	O
)	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
the	O
previous	O
match	O
is	O
"	O
wiki	O
"	O
and	O
current	O
match	O
is	O
"	O
pedia	O
"	O
,	O
then	O
the	O
LZAP	O
encoder	O
adds	O
5	O
new	O
sequences	O
to	O
the	O
dictionary	B-Algorithm
:	O
"	O
wikip	O
"	O
,	O
"	O
wikipe	O
"	O
,	O
"	O
wikiped	O
"	O
,	O
"	O
wikipedi	O
"	O
,	O
and	O
"	O
wikipedia	O
"	O
,	O
where	O
the	O
LZMW	O
encoder	O
adds	O
only	O
the	O
one	O
sequence	O
"	O
wikipedia	O
"	O
.	O
</s>
<s>
This	O
eliminates	O
some	O
of	O
the	O
complexity	O
of	O
LZMW	O
,	O
at	O
the	O
price	O
of	O
adding	O
more	O
dictionary	B-Algorithm
entries	O
.	O
</s>
<s>
LZWL	B-General_Concept
is	O
a	O
syllable-based	O
variant	O
of	O
LZW	B-Algorithm
.	O
</s>
