File size: 3,284 Bytes
94aac97 c1bc1f9 8462a47 ccc0e30 8462a47 ccc0e30 94aac97 bd45a35 94aac97 bd45a35 94aac97 afbfe62 bd45a35 afbfe62 bd45a35 afbfe62 bd45a35 40b40a6 bd45a35 40b40a6 | 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ---
tags:
- name
- lang
- iso-3166
- subdivisions
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
dataset_info:
features:
- name: code
dtype: string
- name: name
dtype: string
- name: name_en
dtype: string
- name: name_ru
dtype: string
- name: name_zh
dtype: string
- name: names_en_alt
list: string
- name: names_ru_alt
list: string
- name: names_zh_alt
list: string
- name: names_other
list: string
- name: region
dtype: string
- name: parent
dtype: string
- name: children
list: string
- name: links
list: string
- name: note
dtype: string
- name: lang
dtype: string
splits:
- name: train
num_bytes: 2050760
num_examples: 5046
download_size: 3822335
dataset_size: 2050760
---
# ISO 3166-2 Subdivision Codes with Lang
Regional subdivision codes with language selection.
## Fields
- **code** (string): ISO 3166-2 subdivision code (e.g., 'US-CA', 'RU-MOW')
- **name** (string): Primary name in selected language
- **region** (string): Parent ISO 3166-1 alpha-2 region code
- **name_en** (string): English name
- **name_ru** (string): Russian name
- **name_zh** (string): Chinese name
- **lang** (string): Language of primary name field (en, ru, or zh)
- Determined by parent region's language rule
- **parent** (string): Parent subdivision code (if applicable)
- **children** (list): Child subdivision codes
- **names_en_alt** (list): Alternative English names
- **names_ru_alt** (list): Alternative Russian names
- **names_zh_alt** (list): Alternative Chinese names
- **names_other** (list): Names in other languages
- **links** (list): Reference links
- **note** (string): Additional notes
## Language Rule
Languages are determined by parent region using hardcoded mapping (same as iso_3166-1_alpha-2).
## Usage
```python
from datasets import load_dataset
ds = load_dataset('cterdam/iso_3166-2', split='train')
# Filter by region
ru_subdivs = ds.filter(lambda x: x['region'] == 'RU')
print(ru_subdivs[0])
# {
# 'code': 'RU-MOW',
# 'name': 'Москва',
# 'region': 'RU',
# 'lang': 'ru',
# }
```
## See Also
- `cterdam/iso_3166-1_alpha-2`: Countries/regions with lang
- `cterdam/iata-metro`: IATA metro codes with lang and coordinates
## Invariants
All entries in this dataset maintain the following invariants (verified by `test/test_invariants.py`):
### Name Field
- **Required**: Every entry has a `name` field
- **Constraint**: `name` always equals one of `name_en`, `name_ru`, or `name_zh` (based on `lang`)
- **Example**: If `lang: ru`, then `name == name_ru`
### Lang Field
- **Required**: Every entry has a `lang` field
- **Values**: One of `en`, `ru`, or `zh`
- **Determination**: Hardcoded by region (not inferred from text)
- **Slavic regions** (RU, UA, BY, KZ, etc.) → `lang: ru`
- **Sinophone regions** (CN, TW, HK, JP, etc.) → `lang: zh`
- **All others** → `lang: en`
## Verify Invariants
Clone the dataset and run tests:
\`\`\`bash
git clone https://huggingface.co/datasets/cterdam/iso_3166-2
cd iso_3166-2
# Install dependencies
pip install datasets
# Run invariant tests
pytest test/test_invariants.py -v
\`\`\`
Expected output: All tests pass, verifying dataset integrity.
|