https://github.com/wondervictor/memsteve
Course Project of Information Theory
https://github.com/wondervictor/memsteve
huffman-coding information-theory shannon
Last synced: about 1 month ago
JSON representation
Course Project of Information Theory
- Host: GitHub
- URL: https://github.com/wondervictor/memsteve
- Owner: wondervictor
- License: mit
- Created: 2017-06-02T05:22:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-12T08:52:25.000Z (almost 9 years ago)
- Last Synced: 2025-03-16T11:38:29.427Z (about 1 year ago)
- Topics: huffman-coding, information-theory, shannon
- Language: C++
- Size: 128 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MemSteve
> Course Project for Infomation Theory. To commemorate the commencement which Steve Jobs delivered in 2005 Stanford University.
## Introduction
* **Compute the Frequency of each letter/punctuation/space**
* **Compute the Entropy of the passage**
* **Compression Methods Implementation**
* Huffmen Coding
* Shannon Coding
* Shannon-Fano-Elias Coding
## Files
* **include** directory for header files
* **Counter.h**: Compute the frequency of elementes and calculate entropy
* **Encoding.h**: Algotithms, Encoder Class
* **Common.h**: timer
* **src** directory for source files (implementation)
* Counter.cpp
* Encoding.cpp
* Common.cpp
* **test**
* **Steve.txt** origin txt
* **xxxxxcode.csv** code word for each letter (The first line is a `\n` character)
* **xxxx.dat** encoded txt
* **xxxxdecode.txt** content by decoded the compressed string.
## Usage
You need to install CMake or use Makefile directly.
````
cd MemSteve
cmake .
make
./MemSteve
````
**ATTENTION**
if you run this source code, you need to specify the path of the whole project!!
Notice the warning in the `main.cpp`
````
#warning please change the path when you run in your own computer
std::string path = "/Users/vic/Dev/Alg/InfomationTheory/MemSteve/test/";
int m = wordCounter.readFile(path+"Steve.txt",s);
````
you need to change the `path`!
## Output
> output files are in the **test** directory
* encoded strings(dat file)
* code (csv file)
* decoded strings(txt file)
## Test
This Program has been tested on my MacBook(macOS Sierra 10.12.14)
````
cmake version: 3.8.0
Clang version:Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
````
## Licence
**This Project is under the MIT Licence**