Module: Huffman::LetterFrequency

Extended by:
LetterFrequency
Included in:
LetterFrequency
Defined in:
lib/huffman/letter_frequency.rb

Instance Method Summary collapse

Instance Method Details

#get_frequencies(txt) ⇒ Object


5
6
7
8
9
# File 'lib/huffman/letter_frequency.rb', line 5

def get_frequencies(txt)
	frequencies = Hash.new(0)
	txt.each_char{|char| frequencies[char] += 1 }
	frequencies
end