예제 #1
0
파일: oving3.py 프로젝트: vhellem/Plab
    def build_tree(self, filepath):
        freqs = kdprims.calc_char_freqs(filepath)

        pq = btl.init_queue(freqs)
        while len(pq) > 1:
            n1 = pq.pop()
            n2 = pq.pop()
            pq.insert(btl.Node(n1, n2))
        self.tree = pq[0]
예제 #2
0
 def build_tree(self, freqs):
     pq = btl.init_queue(freqs)
     while len(pq) > 1:
         n1 = pq.pop()
         n2 = pq.pop()
         pq.insert(btl.Node(n1, n2))
     self.tree = pq[0]
예제 #3
0
파일: oving3.py 프로젝트: vhellem/Plab
    def build_tree(self, filepath):
        freqs = kdprims.calc_char_freqs(filepath)

        pq = btl.init_queue(freqs)
        while len(pq) > 1:
            n1 = pq.pop()
            n2 = pq.pop()
            pq.insert(btl.Node(n1,n2))
        self.tree = pq[0]
예제 #4
0
 def decode(self, encoded_msg):
     return btl.huffman_decode(encoded_msg, self.tree)
예제 #5
0
 def encode(self, message):
     return btl.huffman_encode(message, self.tree)
예제 #6
0
파일: oving3.py 프로젝트: vhellem/Plab
 def decode(self, m):
     return btl.huffman_decode(self.encoded, self.tree)
예제 #7
0
파일: oving3.py 프로젝트: vhellem/Plab
 def encode(self, message):
     self.encoded = btl.huffman_encode(message, self.tree)
     return self.encoded.__repr__()
예제 #8
0
파일: Huffcoder.py 프로젝트: alfiehub/Skole
 def decode(self, encoded):
   return btl.huffman_decode(encoded, self.tree)
예제 #9
0
파일: Huffcoder.py 프로젝트: alfiehub/Skole
 def encode(self, msg):
   return btl.huffman_encode(msg, self.tree)
예제 #10
0
파일: oving3.py 프로젝트: vhellem/Plab
 def encode(self, message):
     self.encoded =  btl.huffman_encode(message, self.tree)
     return self.encoded.__repr__()
예제 #11
0
 def decode(self, message):
     return btl.huffman_decode(message, self.tree)