list_of_baby_names 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +77 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/db/behindthename.txt +23363 -0
- data/db/hadley.csv +258004 -0
- data/db/queensland.csv +2227 -0
- data/db/south_australia.csv +5259 -0
- data/lib/list_of_baby_names.rb +50 -0
- data/lib/list_of_baby_names/data_set.rb +19 -0
- data/lib/list_of_baby_names/name.rb +12 -0
- data/lib/list_of_baby_names/version.rb +3 -0
- data/list_of_baby_names.gemspec +26 -0
- metadata +87 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
require "list_of_baby_names/data_set"
|
2
|
+
require "list_of_baby_names/version"
|
3
|
+
|
4
|
+
module ListOfBabyNames
|
5
|
+
def self.data_sets
|
6
|
+
[:behindthename, :hadley, :south_australia, :queensland]
|
7
|
+
end
|
8
|
+
|
9
|
+
# Behind the Name
|
10
|
+
#
|
11
|
+
# List of given names, genders, and synonyms (related names)
|
12
|
+
# https://www.behindthename.com/api/
|
13
|
+
#
|
14
|
+
# @return [Array<Name>]
|
15
|
+
def self.behindthename
|
16
|
+
DataSet.load_file(File.expand_path("../../db/behindthename.txt", __FILE__), col_sep: " ")
|
17
|
+
end
|
18
|
+
|
19
|
+
# US Data Set
|
20
|
+
#
|
21
|
+
# Distribution of US baby names, 1880-2008
|
22
|
+
# https://github.com/hadley/data-baby-names
|
23
|
+
#
|
24
|
+
# @return [Array<Name>]
|
25
|
+
def self.hadley
|
26
|
+
DataSet.load_file(File.expand_path("../../db/hadley.csv", __FILE__))
|
27
|
+
end
|
28
|
+
|
29
|
+
# South Australia Data Set
|
30
|
+
#
|
31
|
+
# Top Baby Names Female - 2016
|
32
|
+
# https://data.sa.gov.au/data/dataset/popular-baby-names/resource/5e58668a-8150-4c0a-b17e-d55636a318be
|
33
|
+
#
|
34
|
+
# Top Baby Names Male - 2016
|
35
|
+
# https://data.sa.gov.au/data/dataset/popular-baby-names/resource/138f3cf7-edd6-4af2-85c6-2639dbbf04ae
|
36
|
+
#
|
37
|
+
# @return [Array<Name>]
|
38
|
+
def self.south_australia
|
39
|
+
DataSet.load_file(File.expand_path("../../db/south_australia.csv", __FILE__))
|
40
|
+
end
|
41
|
+
|
42
|
+
# Queensland Data Set
|
43
|
+
#
|
44
|
+
# https://data.qld.gov.au/dataset/top-100-baby-names
|
45
|
+
#
|
46
|
+
# @return [Array<Name>]
|
47
|
+
def self.queensland
|
48
|
+
DataSet.load_file(File.expand_path("../../db/queensland.csv", __FILE__))
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "csv"
|
2
|
+
require "list_of_baby_names/name"
|
3
|
+
|
4
|
+
module ListOfBabyNames
|
5
|
+
class DataSet
|
6
|
+
GENDERS = {"m" => :male, "f" => :female, "mf" => :unisex, "fm" => :unisex}
|
7
|
+
|
8
|
+
def self.load_file(path, **options)
|
9
|
+
CSV.foreach(path, headers: true, skip_lines: /^#/, **options).map do |row|
|
10
|
+
Name.new(
|
11
|
+
name: row["name"],
|
12
|
+
gender: GENDERS[row["gender"]],
|
13
|
+
year: (row["year"] || -1).to_i,
|
14
|
+
position: (row["position"] || -1).to_i,
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "list_of_baby_names/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "list_of_baby_names"
|
8
|
+
spec.version = ListOfBabyNames::VERSION
|
9
|
+
spec.authors = ["Tate Johnson"]
|
10
|
+
spec.email = ["tate@tatey.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A list of baby names given to tiny humans}
|
13
|
+
spec.description = %q{A list of baby names given to tiny humans}
|
14
|
+
spec.homepage = "https://github.com/tatey/list_of_baby_names"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(.rspec|.travis.yml|shell.nix)}) || f.match(%r{^(test|spec|features|script|nix)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: list_of_baby_names
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tate Johnson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description: A list of baby names given to tiny humans
|
42
|
+
email:
|
43
|
+
- tate@tatey.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- bin/console
|
54
|
+
- bin/setup
|
55
|
+
- db/behindthename.txt
|
56
|
+
- db/hadley.csv
|
57
|
+
- db/queensland.csv
|
58
|
+
- db/south_australia.csv
|
59
|
+
- lib/list_of_baby_names.rb
|
60
|
+
- lib/list_of_baby_names/data_set.rb
|
61
|
+
- lib/list_of_baby_names/name.rb
|
62
|
+
- lib/list_of_baby_names/version.rb
|
63
|
+
- list_of_baby_names.gemspec
|
64
|
+
homepage: https://github.com/tatey/list_of_baby_names
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.2.16
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: A list of baby names given to tiny humans
|
87
|
+
test_files: []
|