--- 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.