name_bank 0.1.3 → 0.1.5
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/README.md +105 -1
- data/data/countries/AE.yml +667 -161
- data/data/countries/AF.yml +5502 -2376
- data/data/countries/AL.yml +1 -0
- data/data/countries/AO.yml +3 -2
- data/data/countries/AR.yml +1 -0
- data/data/countries/AT.yml +5 -4
- data/data/countries/AZ.yml +2453 -510
- data/data/countries/BD.yml +3340 -523
- data/data/countries/BE.yml +2 -1
- data/data/countries/BF.yml +1 -8
- data/data/countries/BG.yml +6208 -1704
- data/data/countries/BH.yml +1447 -436
- data/data/countries/BI.yml +4 -3
- data/data/countries/BN.yml +9 -8
- data/data/countries/BO.yml +1 -0
- data/data/countries/BR.yml +1 -0
- data/data/countries/BW.yml +1 -0
- data/data/countries/CA.yml +1 -0
- data/data/countries/CH.yml +1 -0
- data/data/countries/CL.yml +1 -0
- data/data/countries/CM.yml +1 -0
- data/data/countries/CO.yml +1 -0
- data/data/countries/CR.yml +1 -0
- data/data/countries/CY.yml +2183 -816
- data/data/countries/CZ.yml +86 -85
- data/data/countries/DE.yml +5 -4
- data/data/countries/DJ.yml +419 -154
- data/data/countries/DK.yml +3 -2
- data/data/countries/DZ.yml +4010 -812
- data/data/countries/EC.yml +1 -0
- data/data/countries/EE.yml +682 -681
- data/data/countries/EG.yml +6886 -2382
- data/data/countries/ES.yml +7 -6
- data/data/countries/ET.yml +5 -7
- data/data/countries/FI.yml +4 -3
- data/data/countries/FJ.yml +5 -11
- data/data/countries/FR.yml +1 -0
- data/data/countries/GB.yml +1 -0
- data/data/countries/GE.yml +4353 -1389
- data/data/countries/GH.yml +1 -0
- data/data/countries/GR.yml +4855 -1159
- data/data/countries/GT.yml +1 -0
- data/data/countries/HK.yml +2997 -366
- data/data/countries/HN.yml +1 -0
- data/data/countries/HR.yml +1 -0
- data/data/countries/HT.yml +1 -0
- data/data/countries/HU.yml +3 -2
- data/data/countries/ID.yml +2 -1
- data/data/countries/IE.yml +1 -0
- data/data/countries/IL.yml +6698 -2194
- data/data/countries/IN.yml +31 -30
- data/data/countries/IQ.yml +5907 -1403
- data/data/countries/IR.yml +3305 -776
- data/data/countries/IS.yml +19 -18
- data/data/countries/IT.yml +36 -35
- data/data/countries/JM.yml +1 -0
- data/data/countries/JO.yml +6222 -1718
- data/data/countries/JP.yml +5585 -1262
- data/data/countries/KH.yml +1031 -1108
- data/data/countries/KR.yml +4437 -1218
- data/data/countries/KW.yml +1 -0
- data/data/countries/KZ.yml +5149 -1113
- data/data/countries/LB.yml +4558 -1021
- data/data/countries/LT.yml +148 -147
- data/data/countries/LU.yml +38 -37
- data/data/countries/LY.yml +5610 -1106
- data/data/countries/MA.yml +3 -2
- data/data/countries/MD.yml +1249 -1248
- data/data/countries/MO.yml +4307 -1228
- data/data/countries/MT.yml +233 -232
- data/data/countries/MU.yml +1 -0
- data/data/countries/MV.yml +271 -270
- data/data/countries/MX.yml +1 -0
- data/data/countries/MY.yml +4 -3
- data/data/countries/NA.yml +1 -0
- data/data/countries/NG.yml +1 -0
- data/data/countries/NL.yml +1 -0
- data/data/countries/NO.yml +1 -0
- data/data/countries/OM.yml +3014 -866
- data/data/countries/PA.yml +1 -0
- data/data/countries/PE.yml +1 -0
- data/data/countries/PH.yml +1 -0
- data/data/countries/PL.yml +311 -310
- data/data/countries/PR.yml +10 -9
- data/data/countries/PS.yml +7018 -2514
- data/data/countries/PT.yml +1 -0
- data/data/countries/QA.yml +1 -0
- data/data/countries/RS.yml +1619 -411
- data/data/countries/RU.yml +5575 -1267
- data/data/countries/SA.yml +5795 -1462
- data/data/countries/SD.yml +5351 -1031
- data/data/countries/SE.yml +4 -3
- data/data/countries/SG.yml +38 -37
- data/data/countries/SI.yml +14 -13
- data/data/countries/SV.yml +1 -2
- data/data/countries/SY.yml +6283 -1779
- data/data/countries/TM.yml +3493 -1704
- data/data/countries/TN.yml +1296 -210
- data/data/countries/TR.yml +282 -281
- data/data/countries/TW.yml +5048 -1984
- data/data/countries/US.yml +1 -0
- data/data/countries/UY.yml +1 -0
- data/data/countries/YE.yml +2394 -485
- data/data/countries/ZA.yml +1 -0
- data/docs/name-counts.md +116 -0
- data/lib/name_bank/pool_schema.rb +24 -0
- data/lib/name_bank/repository.rb +22 -10
- data/lib/name_bank/version.rb +1 -1
- data/lib/name_bank.rb +13 -7
- metadata +21 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f9a25e48d0f047db7cb393aa8545f0857daac15e5febc9f941b48c440f957930
|
|
4
|
+
data.tar.gz: 8ad91e35492cf5e6e703246bbffef2804fa2456ce344bd7425532cb3ef145ae0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ef330f55cd1fdcb87ca7f1391bc3b1c85af3c033e3bb9a4b349bea43651f8eaa4ea9f3ae9c1bac1db5e758ffb331ee403eb6f4639984dbc6246b95a7d78c5e2
|
|
7
|
+
data.tar.gz: df0010e081ef9c6314934dc15c06f98af62b61aac7395c7c66b3f02a0e9540065b192112c58c109cbd3fa64c745c3f4daa3012f71f88b131cc6a6a271943c448
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,36 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.1.5] - 2026-07-24
|
|
8
|
+
|
|
9
|
+
Metadata and documentation only — no API, data or behaviour change.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `spec.metadata` in the gemspec: source, changelog, documentation and bug
|
|
13
|
+
tracker links, and `rubygems_mfa_required`.
|
|
14
|
+
- README: "Where it fits" (factory_bot, `db/seeds.rb`, RSpec examples) and
|
|
15
|
+
"Relation to Faker and FFaker" with a comparison table.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Gem summary and description rewritten so the gem is findable for fake, test
|
|
19
|
+
and seed name data, and states how it relates to Faker and FFaker.
|
|
20
|
+
- README intro says 106 countries (was "105+").
|
|
21
|
+
|
|
22
|
+
## [0.1.4] - 2026-07-24
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- `script:` keyword on `first_name`, `last_name`, `full_name` (default `:latin`)
|
|
26
|
+
selecting the Latin or native-script pool; `NameBank.scripts(country:)` lists
|
|
27
|
+
available scripts. New error `NameBank::UnknownScript`.
|
|
28
|
+
- Native-script pools (Arabic, Cyrillic, Hangul, Han, Kana, Greek, Hebrew,
|
|
29
|
+
Georgian, Khmer, Bengali) for the countries that use them.
|
|
30
|
+
- `docs/name-counts.md`: per-country pool sizes, linked from the README.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
- Re-baked all pools larger (N=6000) and split by script; foreign-script noise
|
|
34
|
+
removed from Latin pools. Default (`:latin`) output for non-Latin countries is
|
|
35
|
+
now Latin-only (previously mixed). Curated CN/UA pools unchanged.
|
|
36
|
+
|
|
7
37
|
## [0.1.3] - 2026-07-23
|
|
8
38
|
|
|
9
39
|
### Added
|
data/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# name_bank
|
|
2
2
|
|
|
3
|
-
Authentic, gender-matched given and family names for
|
|
3
|
+
Authentic, gender-matched given and family names for 106 countries. Deep
|
|
4
4
|
pools (up to 1500 per country/gender), uniform sampling, deterministic, no
|
|
5
5
|
runtime dependencies.
|
|
6
6
|
|
|
7
|
+
Realistic fake name data for database seeds, factories, fixtures and demo
|
|
8
|
+
environments — a companion to [Faker](https://github.com/faker-ruby/faker) and
|
|
9
|
+
[FFaker](https://github.com/ffaker/ffaker) for the name part.
|
|
10
|
+
|
|
7
11
|
## Installation
|
|
8
12
|
|
|
9
13
|
Add to your Gemfile:
|
|
@@ -42,6 +46,98 @@ Sampling is uniform over each pool and fully deterministic for a given
|
|
|
42
46
|
`rng` — the same seed always yields the same name. `gender:` is `:male`
|
|
43
47
|
or `:female`.
|
|
44
48
|
|
|
49
|
+
## Where it fits
|
|
50
|
+
|
|
51
|
+
A factory_bot factory:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
FactoryBot.define do
|
|
55
|
+
factory :user do
|
|
56
|
+
transient do
|
|
57
|
+
country { "DE" }
|
|
58
|
+
person_gender { :female }
|
|
59
|
+
rng { Random.new }
|
|
60
|
+
person { NameBank.full_name(country: country, gender: person_gender, rng: rng) }
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
first_name { person[:firstname] }
|
|
64
|
+
last_name { person[:lastname] }
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Database seeds with a fixed seed, so every run produces the same data:
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
# db/seeds.rb
|
|
73
|
+
rng = Random.new(20_260_724)
|
|
74
|
+
|
|
75
|
+
%w[DE FR IT ES PL].each do |country|
|
|
76
|
+
100.times do
|
|
77
|
+
person = NameBank.full_name(country: country, gender: [:male, :female].sample(random: rng), rng: rng)
|
|
78
|
+
User.create!(first_name: person[:firstname], last_name: person[:lastname], country: country)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
An RSpec example — the seeded RNG makes the case reproducible:
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
it "fits a long Cyrillic name into the invoice header" do
|
|
87
|
+
rng = Random.new(1234)
|
|
88
|
+
customer = NameBank.full_name(country: "RU", gender: :female, rng: rng, script: :native)
|
|
89
|
+
|
|
90
|
+
header = InvoicePdf.new(customer).header
|
|
91
|
+
|
|
92
|
+
expect(header).to include(customer[:lastname])
|
|
93
|
+
end
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Relation to Faker and FFaker
|
|
97
|
+
|
|
98
|
+
Faker and FFaker are full fake-data suites — addresses, companies, lorem ipsum,
|
|
99
|
+
and much more. name_bank does one thing: people names. Use it alongside them,
|
|
100
|
+
not instead of them.
|
|
101
|
+
|
|
102
|
+
| | Faker | FFaker | name_bank |
|
|
103
|
+
| -------------------- | ------------------------------------------------------------ | ------------------------------------------ | ----------------------------------------------------------- |
|
|
104
|
+
| Scope | full fake-data suite | full fake-data suite | people names only |
|
|
105
|
+
| Names addressed by | 58 language/region locales (`de`, `de-AT`, `en-US`) | 30 language modules (`FFaker::NameDE`) | 106 ISO country codes (`DE`, `RU`, `JP`) |
|
|
106
|
+
| Gendered given names | in about 24 of those locales | in 17 of the 30 name modules | in every country |
|
|
107
|
+
| Pool depth | uneven: `en` 1219 m / 4271 f, `de` 574 / 585, `ru` 52 / 56, `ko` 21 | varies per module | up to 1500 per country, gender and script; 89 of 106 at the cap |
|
|
108
|
+
| Native script | one form per locale | one form per module | Latin and native as separate pools, 35 countries |
|
|
109
|
+
| Randomness | global `Faker::Config.random` | global `FFaker::Random.seed` | `rng:` passed in per call, no global state |
|
|
110
|
+
|
|
111
|
+
Counts measured against `faker` and `ffaker` `main` on 2026-07-24.
|
|
112
|
+
|
|
113
|
+
Moving a name call over:
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
Faker::Name.first_name
|
|
117
|
+
FFaker::NameDE.first_name
|
|
118
|
+
# both: gender-agnostic, locale/module picked from global state
|
|
119
|
+
|
|
120
|
+
NameBank.first_name(country: "DE", gender: :female, rng: rng)
|
|
121
|
+
# country and gender explicit, RNG explicit
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Scripts
|
|
125
|
+
|
|
126
|
+
Names come in Latin (default) and, for countries with a non-Latin writing
|
|
127
|
+
system, their native script. Pass `script:`:
|
|
128
|
+
|
|
129
|
+
```ruby
|
|
130
|
+
NameBank.first_name(country: "RU", gender: :male, rng: rng) # => "Dmitry"
|
|
131
|
+
NameBank.first_name(country: "RU", gender: :male, rng: rng, script: :native) # => "Алексей"
|
|
132
|
+
|
|
133
|
+
NameBank.scripts(country: "RU") # => [:latin, :native]
|
|
134
|
+
NameBank.scripts(country: "DE") # => [:latin] (Latin is Germany's script)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`:latin` and `:native` sample from independent pools. For Latin-script countries
|
|
138
|
+
`:native` returns the same (Latin) pool. Requesting a script with no names
|
|
139
|
+
raises `NameBank::UnknownScript`.
|
|
140
|
+
|
|
45
141
|
## Variants
|
|
46
142
|
|
|
47
143
|
Some countries offer an alternate cultural name pool layered on the default.
|
|
@@ -72,6 +168,14 @@ Africa, South Korea, Spain, Sudan, Sweden, Switzerland, Syria, Taiwan, Tunisia,
|
|
|
72
168
|
Turkey, Turkmenistan, Ukraine, United Arab Emirates, United Kingdom, United
|
|
73
169
|
States, Uruguay, Yemen.
|
|
74
170
|
|
|
171
|
+
## Pool sizes
|
|
172
|
+
|
|
173
|
+
Each country provides up to 1500 given names per gender and up to 1500
|
|
174
|
+
surnames; 89 of the 106 countries reach that cap on all three Latin pools, and
|
|
175
|
+
the rest are as large as the source data allows. 35 countries also carry a
|
|
176
|
+
native-script pool. Full per-country counts (Latin and native):
|
|
177
|
+
[docs/name-counts.md](docs/name-counts.md).
|
|
178
|
+
|
|
75
179
|
## License
|
|
76
180
|
|
|
77
181
|
Apache-2.0.
|