gallicagram 1.0.7 → 1.0.9

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gallicagram.rb +3 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc701174f91b6d0af5092efa9944eccd1abdb6981fb9ac396240b62e4457cc8f
4
- data.tar.gz: 027772ca247ea0be65812aed3607c2c705a07a424bfa2e5d21ad4eefc6854462
3
+ metadata.gz: d75ac9432d7de2a125d51816ca14ac0fd13633b9ee7e5cd5d4a6e3db83a3a462
4
+ data.tar.gz: 114fb34abab5ec0a8065de59985a5e7ba05ee374f03dbd8c5977f93000a4e367
5
5
  SHA512:
6
- metadata.gz: 5818bd7812626868cc83bfd9f7c251f5a40eb1a4850823528e676815f7780aeab820ef02c10d55f6086559af17555c9cf5a59abf98c9c376f4f7b11a9063afc1
7
- data.tar.gz: eae5a2a87b17d7b293e408eb27c4ad9bda093fdcc818a07ac084bc5f49ad939077413d8493c4caf91dcb5b0aa8a6d3f4f49170a2a2110664750d4256e6a1add0
6
+ metadata.gz: 981a81960892e29ec189baf3cc3b5fe570fd57cca18a439d21a70bb511316de6a470ca9399b36eb1ef63f3b302c0a4e329498ef9f379186f88407957e6ab551a
7
+ data.tar.gz: aa0bf3a9a724fb2e7264f8810cced108593c7a018baad7e4843f18ecf2a54447721b316b73ed020a3b965e1bd48f2684deffd8bc25b4e52251f1c4e378d4d413
data/lib/gallicagram.rb CHANGED
@@ -13,7 +13,7 @@ class Gallicagram
13
13
  data = ""
14
14
  query.each_with_index do |word, index|
15
15
  query = format_query(word, sum)
16
- response = call_api(word, corpus, start_date, end_date,resolution)
16
+ response = call_api(word, corpus, start_date, end_date, resolution)
17
17
  unless index == 0
18
18
  response = response.gsub("n,gram,annee,mois,jour,total", "\n").strip
19
19
  end
@@ -26,6 +26,8 @@ class Gallicagram
26
26
 
27
27
  if resolution == "mois"
28
28
  data = group_by_resolution(data)
29
+ else
30
+ data = CSV.parse(data, :headers => true)
29
31
  end
30
32
 
31
33
  return data
@@ -54,7 +56,6 @@ end
54
56
  def group_by_resolution(data)
55
57
  csv_parsing = CSV.parse(data, :headers => true)
56
58
  clean_data_array = []
57
-
58
59
  csv_parsing.group_by { |word| [word["annee"], word["mois"], word["gram"]] }.each do |cp|
59
60
  sum = cp[1].sum { |word| word["total"].to_i }
60
61
  new_row = cp[0]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gallicagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Le Roux