Class: Zipfy::WordData

Inherits:
Object
  • Object
show all
Defined in:
lib/zipfy/word_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(word, frequency = 1) ⇒ WordData

Returns a new instance of WordData.



8
9
10
11
# File 'lib/zipfy/word_data.rb', line 8

def initialize word, frequency = 1
	@word = word
	@frequency = frequency
end

Instance Attribute Details

#frequencyObject

Returns the value of attribute frequency.



5
6
7
# File 'lib/zipfy/word_data.rb', line 5

def frequency
  @frequency
end

#wordObject

Returns the value of attribute word.



4
5
6
# File 'lib/zipfy/word_data.rb', line 4

def word
  @word
end

#zip_numberObject

theoretically equal to 1/rank in a text



6
7
8
# File 'lib/zipfy/word_data.rb', line 6

def zip_number
  @zip_number
end