Skip to content

Source coding minor implementations of Shannon, Shannon fano and Huffman.

License

Notifications You must be signed in to change notification settings

laz08/source-coding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Source code: Shannon, Shannon fano and Huffman

About

This little project is product of a class assignment, coded around March 2016.

It was used to study:

  • Obtention of a source of information from a text, where source of information consists in a list of pairs, where each pair contains one letter and its frequency of appearance in the given text.
  • Computation of the entropy of a source of information.
  • Creation of extensions from said source.
  • Implementation of Shannon coding.
  • Implementation of Shannon fano coding.
  • Implementation of Huffman coding.

Structure

It is composed by five files:

  • Shannon.py, which implements Shannon coding.
  • Shannon_fano.py, which implements Shannon fano coding.
  • Huffman.py, which implements Huffman coding.
  • Utils.py, which is the core and has all the important methods that lead to each implementation.
  • main.py, which allows a direct route to use the methods defined in Utils.py from the terminal.

How it works

You can read about what this project implements in the following wikipedia entries:

For each coding (Shannon, Shannon fano and Huffman), the mean length is provided too.

Usage

You can test quickly each coding executing main.py and providing it with a source file.

LICENSE

Copyright 2017 Laura C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Source coding minor implementations of Shannon, Shannon fano and Huffman.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages