diff --git a/CHANGELOG.md b/CHANGELOG.md index 420e1a9..09777f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,8 @@ replacement, and each removed path, column or flag. and carries the same three. `person.prefix` is null where a person has no title, where it used to be an empty string, so `--format sql` writes `NULL` and a `string` struct field reading it becomes `*string`. +- `en_US.phone` draws its exchange, `exch`, from the central office codes NANPA can + assign: `200` to `999`, never `N11`, `555`, `950`, `958`, `959` or `976`. - `ErrNoColumns` is exported, so a caller can tell the one record fence a path can answer from the rest. - An error names a spelling that runs: a layout is named single-quoted and free of diff --git a/data-import/tsv.py b/data-import/tsv.py index 51ea6ea..333e9ab 100644 --- a/data-import/tsv.py +++ b/data-import/tsv.py @@ -5,10 +5,10 @@ from pathlib import Path def write(path, columns, rows): - """Write the rows as a TSV; the table needs two rows, and every cell must be non-empty and free of tabs, newlines and braces.""" + """Write the rows as a TSV; the table needs two rows, and every cell is stripped, and must be non-empty and free of tabs, newlines and braces.""" lines = ["\t".join(columns)] for row in rows: - cells = [str(row[c]) for c in columns] + cells = [str(row[c]).strip() for c in columns] if not all(cells) or any(re.search(r"[\t\n{}]", c) for c in cells): raise ValueError(f"{path}: a cell is empty or holds a tab, newline or brace: {row}") lines.append("\t".join(cells)) diff --git a/data/en_US/phone.json b/data/en_US/phone.json index b47298b..a5e9f9e 100644 --- a/data/en_US/phone.json +++ b/data/en_US/phone.json @@ -3,13 +3,45 @@ "format": "({area}) {exch}-{line}", "weight": 2, "area": ["202", "212", "213", "305", "312", "404", "415", "469", "503", "512", "602", "617", "646", "702", "718", "720", "737", "773", "786", "808", "917"], - "exch": "{int(100,999)}", + "exch": [ + { "format": "{int(2,9)}0{digits(1)}", "weight": 80 }, + { "format": "{int(2,9)}1{int(2,9)}", "weight": 64 }, + { "format": "{int(2,9)}10", "weight": 8 }, + { "format": "{int(2,4)}{int(2,9)}{digits(1)}", "weight": 240 }, + { "format": "{int(6,8)}{int(2,9)}{digits(1)}", "weight": 240 }, + { "format": "5{int(2,4)}{digits(1)}", "weight": 30 }, + { "format": "5{int(6,9)}{digits(1)}", "weight": 40 }, + { "format": "55{int(0,4)}", "weight": 5 }, + { "format": "55{int(6,9)}", "weight": 4 }, + { "format": "9{int(2,4)}{digits(1)}", "weight": 30 }, + { "format": "9{int(8,9)}{digits(1)}", "weight": 20 }, + { "format": "95{int(1,7)}", "weight": 7 }, + { "format": "96{digits(1)}", "weight": 10 }, + { "format": "97{int(0,5)}", "weight": 6 }, + { "format": "97{int(7,9)}", "weight": 3 } + ], "line": "{digits(4)}" }, { "format": "{area}-{exch}-{line}", "area": ["202", "212", "213", "305", "312", "404", "415", "469", "503", "512", "602", "617", "646", "702", "718", "720", "737", "773", "786", "808", "917"], - "exch": "{int(100,999)}", + "exch": [ + { "format": "{int(2,9)}0{digits(1)}", "weight": 80 }, + { "format": "{int(2,9)}1{int(2,9)}", "weight": 64 }, + { "format": "{int(2,9)}10", "weight": 8 }, + { "format": "{int(2,4)}{int(2,9)}{digits(1)}", "weight": 240 }, + { "format": "{int(6,8)}{int(2,9)}{digits(1)}", "weight": 240 }, + { "format": "5{int(2,4)}{digits(1)}", "weight": 30 }, + { "format": "5{int(6,9)}{digits(1)}", "weight": 40 }, + { "format": "55{int(0,4)}", "weight": 5 }, + { "format": "55{int(6,9)}", "weight": 4 }, + { "format": "9{int(2,4)}{digits(1)}", "weight": 30 }, + { "format": "9{int(8,9)}{digits(1)}", "weight": 20 }, + { "format": "95{int(1,7)}", "weight": 7 }, + { "format": "96{digits(1)}", "weight": 10 }, + { "format": "97{int(0,5)}", "weight": 6 }, + { "format": "97{int(7,9)}", "weight": 3 } + ], "line": "{digits(4)}" } ] diff --git a/data/misc/currency.tsv b/data/misc/currency.tsv index 0e9f584..dacb23d 100644 --- a/data/misc/currency.tsv +++ b/data/misc/currency.tsv @@ -71,7 +71,7 @@ JPY 0 Yen 392 ¥ KES 2 Kenyan Shilling 404 KES KGS 2 Som 417 ⃀ KHR 2 Riel 116 ៛ -KMF 0 Comorian Franc 174 CF +KMF 0 Comorian Franc 174 CF KPW 2 North Korean Won 408 ₩ KRW 0 Won 410 ₩ KWD 3 Kuwaiti Dinar 414 KWD diff --git a/data/misc/territory.tsv b/data/misc/territory.tsv index 787996d..dc760cd 100644 --- a/data/misc/territory.tsv +++ b/data/misc/territory.tsv @@ -48,7 +48,7 @@ CO COL 57 Bogota CO COP 🇨🇴 es-CO Colombia 170 .co CR CRI 506 San Jose CR CRC 🇨🇷 es-CR,en Costa Rica 188 .cr CU CUB 53 Havana CU CUP 🇨🇺 es-CU,pap Cuba 192 .cu CV CPV 238 Praia CV CVE 🇨🇻 pt-CV Cape Verde 132 .cv -CW CUW 599 Willemstad NL XCG 🇨🇼 nl,pap Curaçao 531 .cw +CW CUW 599 Willemstad NL XCG 🇨🇼 nl,pap Curaçao 531 .cw CX CXR 61 Flying Fish Cove AU AUD 🇨🇽 en,zh,ms-CX Christmas Island 162 .cx CY CYP 357 Nicosia CY EUR 🇨🇾 el-CY,tr-CY,en Cyprus 196 .cy CZ CZE 420 Prague CZ CZK 🇨🇿 cs,sk Czechia 203 .cz