Skip to main content

Convert Vietnamese administrative addresses from the old district-based format to the 2025 normalized structure.

Project description

Vietnam Administrative Address Converter Toolkit

Convert Vietnamese administrative addresses from the old province / district / ward structure to the 2025 normalized province / ward structure.

Python PyPI Version Dataset CI


Features

  • Parse free-form Vietnamese addresses in the old administrative format.
  • Convert old province/district/ward references into the new province/ward format.
  • Normalize large CSV datasets in streaming mode.
  • Reuse an in-memory converter with caching for better batch performance.

Package Name

  • PyPI distribution: vietnam-address-converter
  • Python import: vietnam_address_converter
  • CLI command: vietnam-address-converter

Installation

From source

git clone https://github.com/trng28/address-converter.git
cd address-converter

python -m venv .venv

# macOS / Linux
source .venv/bin/activate

# Windows PowerShell
.\.venv\Scripts\Activate.ps1

pip install -e .

From PyPI

pip install vietnam-address-converter

Development-only test dependencies

pip install -r requirements.txt

CLI Usage

Convert one address

vietnam-address-converter --address "Đường Trần Não, Phường Thảo Điền, TP Thủ Đức, Thành phố Hồ Chí Minh"

Run as a module

python -m vietnam_address_converter --address "Đường Trần Não, Phường Thảo Điền, TP Thủ Đức, Thành phố Hồ Chí Minh"

Convert a CSV file

vietnam-address-converter \
  --input-csv data/vietnam_full_address.csv \
  --output-csv data/vietnam_full_address.converted.csv \
  --address-column full_address \
  --cache-size 4096

Output schema:

index,full_address,street,ward,district,city,full_address_new

Python API

from vietnam_address_converter import auto_convert_address, create_converter

result = auto_convert_address(
    "Đường Trần Não, Phường Thảo Điền, TP Thủ Đức, Thành phố Hồ Chí Minh"
)

converter = create_converter()
batch_result = converter.auto_convert_address(
    "Quốc lộ 91C, Xã Đa Phước, Huyện An Phú, Tỉnh An Giang"
)

Dataset

This project uses the public dataset:

Download example:

pip install huggingface_hub
python -c "
from huggingface_hub import hf_hub_download
hf_hub_download(
    repo_id='trucmtnguyen/vietnam-address-collection',
    filename='vietnam_full_address.csv',
    repo_type='dataset',
    local_dir='data/'
)
"

Performance

Validated on 79,931 real addresses from the full dataset.

Performance Summary Conversion Outcomes Remap Rate by Administrative Unit Type Top Provinces by Ward Remap Rate Unresolved Addresses by Province


Project Structure

address-converter/
├── .github/
│   └── workflows/
├── data/
├── docs/
│   └── assets/
├── src/
│   ├── vietnam_address_converter/  # installable Python package
│   ├── batch.py                    # compatibility wrappers for old imports
│   ├── converter.py
│   └── ...
├── tests/
├── pyproject.toml
├── main.py
├── README.md
└── requirements.txt

Release Flow

  • CI runs on every push and pull request.
  • Create a tag like v0.1.0 to trigger the release workflow.
  • Release artifacts include both .whl and .tar.gz.

License

Apache 2.0 © trng28

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vietnam_address_converter-1.0.3.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vietnam_address_converter-1.0.3-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file vietnam_address_converter-1.0.3.tar.gz.

File metadata

File hashes

Hashes for vietnam_address_converter-1.0.3.tar.gz
Algorithm Hash digest
SHA256 6ac0dd101f55ca65098d4c31203dda5d9054f577a1f984f9ceddd301b01e57d8
MD5 025f0e8f6a1edf715c07e7e00cdbaf3c
BLAKE2b-256 95a37c14a0846674c90debc3084f71862a935f00e257e24cc4f45a7567fc2b7c

See more details on using hashes here.

File details

Details for the file vietnam_address_converter-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for vietnam_address_converter-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 01f857c8cac5105378cf654acb94d5f811622cbd65947c8104f14ad294ca9785
MD5 071d8631f639fe2d575965c79ed09af2
BLAKE2b-256 b66ed88d183fd206acd993233ca636eec5d9b8150294b1e5600658e8309fd0ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page