UnCodeGL.data_structures package

Submodules

UnCodeGL.data_structures.encoder module

class UnCodeGL.data_structures.encoder.Encoder(simbols, dictionary)

Bases: object

Encoder based on Trie. See more in : https://en.wikipedia.org/wiki/Trie#:~:text=In%20computer%20science%2C%20a%20trie,the%20keys%20are%20usually%20strings.

encode_sentence(sentence)

Returns string with the given word to search. None if invalid seach

getNode()

Returns new trie node (initialized to NULLs)

insert(word, assigned_word)

If not present, inserts key into trie If the key is prefix of trie node, just marks leaf node

class UnCodeGL.data_structures.encoder.EncoderNode(simbols)

Bases: object

UnCodeGL.data_structures.huffman_generator module

class UnCodeGL.data_structures.huffman_generator.Huffman_Generator(simbols, base_nodes, arity)

Bases: object

Utility class to generate Huffman Code

make_huffman_code()
make_node(probability, word=None)

Returns new node (initialized to NULLs)

class UnCodeGL.data_structures.huffman_generator.Huffman_Node(simbols, probability, word=None)

Bases: object

UnCodeGL.data_structures.trie module

class UnCodeGL.data_structures.trie.Trie(simbols, **kwargs)

Bases: object

Data structure Trie. See more in : https://en.wikipedia.org/wiki/Trie#:~:text=In%20computer%20science%2C%20a%20trie,the%20keys%20are%20usually%20strings.

complete_word(word)

Finds if there is a way to complete the word to make it belong to the Trie

getNode()

Returns new trie node (initialized to NULLs)

insert(word)

If not present, inserts key into trie If the key is prefix of trie node, just marks leaf node

is_prefix()

Search for prefixes of words

search(word)

Search key in the trie Returns true if key presents in trie, else false

class UnCodeGL.data_structures.trie.TrieNode(simbols)

Bases: object

Module contents