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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +105 -1
  4. data/data/countries/AE.yml +667 -161
  5. data/data/countries/AF.yml +5502 -2376
  6. data/data/countries/AL.yml +1 -0
  7. data/data/countries/AO.yml +3 -2
  8. data/data/countries/AR.yml +1 -0
  9. data/data/countries/AT.yml +5 -4
  10. data/data/countries/AZ.yml +2453 -510
  11. data/data/countries/BD.yml +3340 -523
  12. data/data/countries/BE.yml +2 -1
  13. data/data/countries/BF.yml +1 -8
  14. data/data/countries/BG.yml +6208 -1704
  15. data/data/countries/BH.yml +1447 -436
  16. data/data/countries/BI.yml +4 -3
  17. data/data/countries/BN.yml +9 -8
  18. data/data/countries/BO.yml +1 -0
  19. data/data/countries/BR.yml +1 -0
  20. data/data/countries/BW.yml +1 -0
  21. data/data/countries/CA.yml +1 -0
  22. data/data/countries/CH.yml +1 -0
  23. data/data/countries/CL.yml +1 -0
  24. data/data/countries/CM.yml +1 -0
  25. data/data/countries/CO.yml +1 -0
  26. data/data/countries/CR.yml +1 -0
  27. data/data/countries/CY.yml +2183 -816
  28. data/data/countries/CZ.yml +86 -85
  29. data/data/countries/DE.yml +5 -4
  30. data/data/countries/DJ.yml +419 -154
  31. data/data/countries/DK.yml +3 -2
  32. data/data/countries/DZ.yml +4010 -812
  33. data/data/countries/EC.yml +1 -0
  34. data/data/countries/EE.yml +682 -681
  35. data/data/countries/EG.yml +6886 -2382
  36. data/data/countries/ES.yml +7 -6
  37. data/data/countries/ET.yml +5 -7
  38. data/data/countries/FI.yml +4 -3
  39. data/data/countries/FJ.yml +5 -11
  40. data/data/countries/FR.yml +1 -0
  41. data/data/countries/GB.yml +1 -0
  42. data/data/countries/GE.yml +4353 -1389
  43. data/data/countries/GH.yml +1 -0
  44. data/data/countries/GR.yml +4855 -1159
  45. data/data/countries/GT.yml +1 -0
  46. data/data/countries/HK.yml +2997 -366
  47. data/data/countries/HN.yml +1 -0
  48. data/data/countries/HR.yml +1 -0
  49. data/data/countries/HT.yml +1 -0
  50. data/data/countries/HU.yml +3 -2
  51. data/data/countries/ID.yml +2 -1
  52. data/data/countries/IE.yml +1 -0
  53. data/data/countries/IL.yml +6698 -2194
  54. data/data/countries/IN.yml +31 -30
  55. data/data/countries/IQ.yml +5907 -1403
  56. data/data/countries/IR.yml +3305 -776
  57. data/data/countries/IS.yml +19 -18
  58. data/data/countries/IT.yml +36 -35
  59. data/data/countries/JM.yml +1 -0
  60. data/data/countries/JO.yml +6222 -1718
  61. data/data/countries/JP.yml +5585 -1262
  62. data/data/countries/KH.yml +1031 -1108
  63. data/data/countries/KR.yml +4437 -1218
  64. data/data/countries/KW.yml +1 -0
  65. data/data/countries/KZ.yml +5149 -1113
  66. data/data/countries/LB.yml +4558 -1021
  67. data/data/countries/LT.yml +148 -147
  68. data/data/countries/LU.yml +38 -37
  69. data/data/countries/LY.yml +5610 -1106
  70. data/data/countries/MA.yml +3 -2
  71. data/data/countries/MD.yml +1249 -1248
  72. data/data/countries/MO.yml +4307 -1228
  73. data/data/countries/MT.yml +233 -232
  74. data/data/countries/MU.yml +1 -0
  75. data/data/countries/MV.yml +271 -270
  76. data/data/countries/MX.yml +1 -0
  77. data/data/countries/MY.yml +4 -3
  78. data/data/countries/NA.yml +1 -0
  79. data/data/countries/NG.yml +1 -0
  80. data/data/countries/NL.yml +1 -0
  81. data/data/countries/NO.yml +1 -0
  82. data/data/countries/OM.yml +3014 -866
  83. data/data/countries/PA.yml +1 -0
  84. data/data/countries/PE.yml +1 -0
  85. data/data/countries/PH.yml +1 -0
  86. data/data/countries/PL.yml +311 -310
  87. data/data/countries/PR.yml +10 -9
  88. data/data/countries/PS.yml +7018 -2514
  89. data/data/countries/PT.yml +1 -0
  90. data/data/countries/QA.yml +1 -0
  91. data/data/countries/RS.yml +1619 -411
  92. data/data/countries/RU.yml +5575 -1267
  93. data/data/countries/SA.yml +5795 -1462
  94. data/data/countries/SD.yml +5351 -1031
  95. data/data/countries/SE.yml +4 -3
  96. data/data/countries/SG.yml +38 -37
  97. data/data/countries/SI.yml +14 -13
  98. data/data/countries/SV.yml +1 -2
  99. data/data/countries/SY.yml +6283 -1779
  100. data/data/countries/TM.yml +3493 -1704
  101. data/data/countries/TN.yml +1296 -210
  102. data/data/countries/TR.yml +282 -281
  103. data/data/countries/TW.yml +5048 -1984
  104. data/data/countries/US.yml +1 -0
  105. data/data/countries/UY.yml +1 -0
  106. data/data/countries/YE.yml +2394 -485
  107. data/data/countries/ZA.yml +1 -0
  108. data/docs/name-counts.md +116 -0
  109. data/lib/name_bank/pool_schema.rb +24 -0
  110. data/lib/name_bank/repository.rb +22 -10
  111. data/lib/name_bank/version.rb +1 -1
  112. data/lib/name_bank.rb +13 -7
  113. metadata +21 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1002b10463391e94b864c3e1ee16e75619338470b7934a7f8dbe3a0b2800b74e
4
- data.tar.gz: 48fa865b036403596ec5faad42b1e19ab608229d7bc489bc108c6cce9cfd31db
3
+ metadata.gz: f9a25e48d0f047db7cb393aa8545f0857daac15e5febc9f941b48c440f957930
4
+ data.tar.gz: 8ad91e35492cf5e6e703246bbffef2804fa2456ce344bd7425532cb3ef145ae0
5
5
  SHA512:
6
- metadata.gz: 414c382b0348cda3da80e7e441fb459f7dc67690caea107fb71ef6fc170d018d5f6ae0bf25dfdba37471afda1d68f80fe14865a7a581014d43c24509b8b0a533
7
- data.tar.gz: 740263807cc32ba8d090e6e41291170b6862ba8151b80f5b2a968c0824f95f9b452a78e6a6acafbda3686dc5d17818d0e04bf8ab97def983054cf15bedc9e41e
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 105+ countries. Deep
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.