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

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

Python 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.2.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.2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for vietnam_address_converter-1.0.2.tar.gz
Algorithm Hash digest
SHA256 adb05fceae9f3d7b8fafd8c36a1aa7440136bd66e71a25771488caef7315189a
MD5 fd074cc13812bdf6dbcd1371188defa8
BLAKE2b-256 95eeb380ab23a55e611e035606496ed317dedda20bd71de5109bbbb6ba535965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vietnam_address_converter-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d8d5c81957b14797bb69cf92f49f36403437e4c44ffd5952f2af0aafc919580
MD5 96cc6e9b848fd667309cafa2baa0e4ff
BLAKE2b-256 c40d1c31423f022995609220e3f99e5ccaca7b55fd874c0a4d00a0a49344c460

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