Method: CBETA::CharFrequency#initialize

Defined in:
lib/cbeta/char_freq.rb

#initialize(xml_root, opts = {}) ⇒ CharFrequency

Returns a new instance of CharFrequency.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :top (Integer)


3
4
5
6
7
8
9
10
11
# File 'lib/cbeta/char_freq.rb', line 3

def initialize(xml_root, opts={})
  @xml_root = xml_root
  @config = {
    top: 10
  }
  @config.merge!(opts)
  @result = {}
  @current = @result
end