https://github.com/your-vo1d/arithmetic-compression
https://github.com/your-vo1d/arithmetic-compression
arithmetic arithmetic-coding compressin compression-algorithm
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/your-vo1d/arithmetic-compression
- Owner: Your-vo1d
- Created: 2023-12-18T07:06:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-12T14:57:10.000Z (about 1 year ago)
- Last Synced: 2025-01-01T04:50:41.872Z (6 months ago)
- Topics: arithmetic, arithmetic-coding, compressin, compression-algorithm
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Huffman Encoding and Decoding
This Python script implements Huffman encoding and decoding algorithms. Huffman encoding is a widely used technique for lossless data compression.
## Usage
1. Make sure you have Python installed on your system.
2. Clone this repository or download the `main.py` file.
3. Open a terminal or command prompt.
4. Navigate to the directory containing the `main.py` file.
5. Run the script using the following command:```
main.py
```6. Follow the instructions to enter the name of the file you want to encode.
7. The encoded and decoded files will be saved in the `result` directory.## Description
The script provides two main functions:
- `encode(input_file, encode_file)`: Encodes the contents of the input file using Huffman encoding and writes the encoded data to the specified output file.
- `decode(encode_file, decode_file)`: Decodes the encoded data from the input file and writes the decoded text to the specified output file.## File Structure
- `main.py`: The main Python script.
- `result`: Directory to store the encoded and decoded files.
- `README.md`: Documentation explaining how to use the script.## Requirements
- Python 3.x
- The input file to be encoded## Example
Suppose you have a text file named `input.txt` that you want to encode:
1. Run the script and enter `input.txt` when prompted.
2. The encoded file (`encode.txt`) and the decoded file (`decode.txt`) will be created in the `result` directory.## Author
This script was written by Your_Vo1d.