Git Product home page Git Product logo

marthenn / lzw-webapp Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 40 KB

A simple webapp to compress ASCII string primarily with LZW, it can also compress further by BWT and RLE

Home Page: https://lzw-webapp.vercel.app

JavaScript 66.00% HTML 15.92% CSS 18.08%
backend compression compression-algorithm express-js frontend greedy-algorithm bwt-transform lzw-compression rle-compression-algorithm

lzw-webapp's Introduction

lzw-webapp

A web application for LZW compression and decompression. The compression can be further enhanced by BWT and RLE algorithms.

Screenshot of the Web App

Usage

The web application is hosted on vercel (front-end) and railway (back-end). You can visit the web application at https://lzw-webapp.vercel.app/.

Projects Structure

  • src/backend: The backend of the web application, which is a RESTful API server using Express.js.
  • src/frontend: The frontend of the web application, built on vanilla HTML/CSS/JS.

Development

Prerequisites

  • Node.js v14.17.0
  • npm v6.14.13

Algorithm

General

  • The algorithm is implemented in JavaScript
  • The algorithm is implemented in src/backend/algorithms.js
  • The general process is input -> LZW -> (BWT -> RLE) -> output for compression
  • The general process is input -> (RLE -> BWT) -> LZW -> output for decompression
  • The steps in parentheses are optional (can be enabled/disabled)

LZW

  • LZW algorithm is a lossless compression algorithm
  • The implementation of the LZW algorithm is done as follows:
  1. Initialize the dictionary with all the ASCII characters
  2. Read the input character by character
  3. If the current character is in the dictionary, append it to the current string
  4. If the current character is not in the dictionary, add the current string to the output and add the current string + the current character to the dictionary
  5. Repeat step 3 and 4 until the end of the input
  6. Add the last string to the output

BWT

  • BWT is not a compression algorithm, instead it is a transformation algorithm as a pre-processing step for compression
  • The implementation of the BWT algorithm is done as follows:
  1. Add a special character to the end of the input
  2. Create a matrix of all the rotations of the input
  3. Sort the matrix alphabetically
  4. The last column of the matrix is the output

RLE

  • RLE is a very simple compression algorithm based on the repetition of characters
  • The implementation of the RLE algorithm is done as follows:
  1. Read the input character by character
  2. If the current character is the same as the previous character, increment the counter
  3. If the current character is not the same as the previous character, add the counter and the previous character to the output
  4. Repeat step 2 and 3 until the end of the input
  5. Add the last counter and the last character to the output

lzw-webapp's People

Contributors

marthenn avatar

Watchers

 avatar

lzw-webapp's Issues

Deployment is Down

The deployment is being brought down in order for another project to take place in the free deployment service

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.