-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (56 loc) · 2.13 KB
/
Makefile
File metadata and controls
70 lines (56 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SHELL := /bin/bash
RAW := data/raw
DER := data/derived
SSA_ZIP := $(RAW)/ssa_names.zip
CENSUS_ZIP := $(RAW)/census_2010_surnames.zip
.PHONY: all deps lists demo check clean clean-zips clean-sources
all: deps lists
deps:
@command -v git >/dev/null
@command -v unzip >/dev/null
@command -v jq >/dev/null || (echo "Missing jq. Install jq: https://jqlang.org/"; exit 1)
@command -v wget >/dev/null || command -v curl >/dev/null || (echo "Need wget or curl"; exit 1)
@python -m pip install -r requirements.txt
lists: $(DER)/first_master.txt $(DER)/last_master.txt
$(SSA_ZIP):
mkdir -p $(RAW)
@echo "[*] Downloading SSA names.zip..."
@set -e; \
if command -v wget >/dev/null 2>&1; then \
wget -O $@ https://www.ssa.gov/oact/babynames/names.zip; \
else \
curl -fL --retry 3 --retry-delay 2 -A "Mozilla/5.0" -o $@ https://www.ssa.gov/oact/babynames/names.zip; \
fi
@unzip -t $@ >/dev/null
$(CENSUS_ZIP):
mkdir -p $(RAW)
@echo "[*] Downloading Census surnames.zip..."
@set -e; \
if command -v wget >/dev/null 2>&1; then \
wget -O $@ https://www2.census.gov/topics/genealogy/2010surnames/names.zip; \
else \
curl -fL --retry 3 --retry-delay 2 -o $@ https://www2.census.gov/topics/genealogy/2010surnames/names.zip; \
fi
@unzip -t $@ >/dev/null
$(DER)/first_master.txt $(DER)/last_master.txt: scripts/build_lists.sh $(SSA_ZIP) $(CENSUS_ZIP)
bash scripts/build_lists.sh "$(RAW)" "$(DER)"
demo: lists
@echo "== Names =="
@python scripts/gen_names.py -n 10 --unique --seed 1337
@echo
@echo "== Handles (acrostic=npc) =="
@python scripts/gen_handles.py --wordfile data/derived/last_master.txt --acrostic npc --numwords 3 --delimiter "-" --seed 1337 --titlecase -n 10
check: lists
@echo "[*] verifying derived files..."
@test -f $(DER)/first_master.txt
@test -f $(DER)/last_master.txt
@echo "[*] counts:"
@wc -l $(DER)/us_first.txt $(DER)/us_last.txt $(DER)/intl_first.txt $(DER)/intl_last.txt $(DER)/first_master.txt $(DER)/last_master.txt
@echo "[*] sample:"
@python scripts/gen_names.py -n 1 --seed 1
clean-zips:
rm -f $(SSA_ZIP) $(CENSUS_ZIP)
clean-sources:
rm -rf $(RAW)/popular-names-by-country-dataset
clean:
rm -rf $(RAW) $(DER)