PPhraseNacre
Product

Product features · LZ78 phrase tokens

01

PhraseNacre supports inspection of LZ78 dictionary references and the final incomplete phrase, with byte fixtures kept alongside the proposed encoder.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

LZ78 phrase tokens

● ● ●PhraseNacre●
A concrete starting point · LZ78 phrase tokens ×
def lz78_tokens(data):
    if type(data) is not bytes or len(data) > 4096:
        raise ValueError("lz78.input")
    dictionary, phrase, output = {b"": 0}, b"", []
    for byte in data:
        extended = phrase + bytes([byte])
        if extended in dictionary:
            phrase = extended
        else:
            output.append((dictionary[phrase], byte))
            dictionary[extended] = len(dictionary)
            phrase = b""
    if phrase:
        output.append((dictionary[phrase], None))
    return output
✳Encode at most 4096 bytes into LZ78 dictionary-index and next-byte pairs.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗