zipfy 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/lib/zipfy/version.rb +1 -1
  4. data/lib/zipfy.rb +5 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb3654670c2336cb47fa2dac85bc4db0cc3c9f2d
4
- data.tar.gz: 4fe446531e03d9c4594b759aba220e4dac6e0fd0
3
+ metadata.gz: 17e618c03b645632d79392e3c654de7fc20411cf
4
+ data.tar.gz: aa0d47c69385a7ff49024985c064786d2a06ea26
5
5
  SHA512:
6
- metadata.gz: c1cec8c3bdfaeaab8674819f335d163c0dabeb02469d12424e04d8ab5e29bc9d8060e3a813d2d43ca73f00d02aa28fb7f0fad18481cc84a6a218f62cbf47561c
7
- data.tar.gz: c08caf4d0d40380284ef7da440a6b28822b1b0bacd70ac562de625e76dc932a0b6488b29cd3a2a2ec71e11bf618fd0cbbe9fb356d6f5dba33af4f152d551a549
6
+ metadata.gz: c2485f416b1cde499f19deeb05c99b2293655759229b046b8aa0b7bf9f73c11643dae3af35d5880a387249e8b0e0e5c2e05b1d3a545909da06d17a89683181c5
7
+ data.tar.gz: af86ef5e591acc56b4a429645e059dc449d6c8da7cc5744bfea5a58f96b0860535e41701ce6e339677cef8447199864a4ff82b430ae59b53109cff89248bc988
data/Gemfile CHANGED
@@ -3,3 +3,5 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in zipfy.gemspec
4
4
  gemspec
5
5
  gem 'putsplus'
6
+ #for now
7
+ gem 'pry'
data/lib/zipfy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zipfy
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
data/lib/zipfy.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  begin #dev optional gems
2
2
  require 'pry'
3
3
  rescue LoadError
4
+ STDERR.puts "some dev deps not installed .. ignoring"
4
5
  #probably a travis or non-dev build
5
6
  end
6
7
 
@@ -47,6 +48,7 @@ module Zipfy
47
48
  temp_hash.keys.each do |k|
48
49
  @distribution << WordData.new(k, temp_hash[k])
49
50
  end
51
+ sort_distribution
50
52
  end
51
53
 
52
54
  def sort_distribution
@@ -97,12 +99,13 @@ module Zipfy
97
99
 
98
100
  #must calculate zipfness first
99
101
  def calculate_std_dev_from_reg
100
- #the zipfness should be equal to 1/rank. lets see the average deviatoin form that number
102
+ #binding.pry
103
+ #the zipfness should be equal to 1/rank. lets see the average deviation from that number
101
104
  length = @distribution.length
102
105
  deviations = []
103
106
 
104
107
  @distribution.each_with_index do |wd,i|
105
- theoretical = 1/(length - i).to_f
108
+ theoretical = 1.0/(length - i).to_f
106
109
  actual = wd.zip_number
107
110
  deviation = (theoretical - actual).abs
108
111
  deviations << deviation
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zipfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bjubes