name_popularity 0.1.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +42 -0
- data/data/female_names.tsv +91244 -0
- data/data/male_names.tsv +79125 -0
- data/lib/name_popularity/cache.rb +42 -0
- data/lib/name_popularity/dataset.rb +49 -0
- data/lib/name_popularity/version.rb +5 -0
- data/lib/name_popularity.rb +32 -0
- metadata +79 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0ce97b6c2828b3422e3c1b36a8ad87edd2bfa43a6cd545416f4661412376ea1d
|
|
4
|
+
data.tar.gz: 8cf7362ac32ab20713f0e6a250aba1966256ce0ab907c7a2f840760e03cde70a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bdf5d7fd73b0bf02e7aea3d8142d034e9383a312fdb5e0642686275acba9f6bf54d954806849b47417ba9e262bb90c7c0278756ae8a6c6bbbe756d3f042ba38f
|
|
7
|
+
data.tar.gz: ffcc8aa0dc35e347550cd998a0dead4da645bf23bbe20dd6e0baabe64e0bc1ad19500a32f27b35b68ad0557d1a4b6e82980035e49f746fe6e432bd3654bd6573
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2025 Joel E. Svensson
|
|
2
|
+
|
|
3
|
+
This software is dual-licensed:
|
|
4
|
+
|
|
5
|
+
1. For everyone: GNU General Public License v3.0 (see below)
|
|
6
|
+
2. The copyright holder (Joel E. Svensson) retains the right to use,
|
|
7
|
+
modify, and distribute this software under any terms, including
|
|
8
|
+
proprietary ones, without the restrictions of the GPL.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
GNU GENERAL PUBLIC LICENSE
|
|
13
|
+
Version 3, 29 June 2007
|
|
14
|
+
|
|
15
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
16
|
+
|
|
17
|
+
Everyone is permitted to copy and distribute verbatim copies of this
|
|
18
|
+
license document, but changing it is not allowed.
|
|
19
|
+
|
|
20
|
+
For the full text of the GNU General Public License v3.0, see:
|
|
21
|
+
https://www.gnu.org/licenses/gpl-3.0.txt
|
data/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# NamePopularity
|
|
2
|
+
|
|
3
|
+
Fast lookups for name popularity from TSV datasets.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem 'name_popularity'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'name_popularity'
|
|
15
|
+
|
|
16
|
+
cache = NamePopularity::Cache.new
|
|
17
|
+
|
|
18
|
+
NamePopularity.popular_name?("Alice", threshold: 500, cache: cache)
|
|
19
|
+
# => true/false
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Data
|
|
23
|
+
|
|
24
|
+
Two TSV files included under `data/` with columns: NAME<TAB>COUNT
|
|
25
|
+
|
|
26
|
+
- `female_names.tsv`
|
|
27
|
+
- `male_names.tsv`
|
|
28
|
+
|
|
29
|
+
Counts may include spaces (e.g., "1 234"); the parser normalizes this.
|
|
30
|
+
|
|
31
|
+
The name data is derived from statistics originally published by
|
|
32
|
+
[Statistics Sweden (SCB)](https://www.scb.se/) under
|
|
33
|
+
[CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
34
|
+
|
|
35
|
+
## Caching
|
|
36
|
+
|
|
37
|
+
- Threshold-keyed caches: only names meeting the threshold are kept to minimize memory.
|
|
38
|
+
- Provide your own cache or let the module use a default global cache.
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
GPL-3.0 — see LICENSE for details.
|