india-address-parser
Parse messy Indian addresses into structured fields with a small local model (1.5B, runs on CPU, no API key).
from india_address_parser import parse
parse("D.No 14/2, Gandhi Road, Pollachi, Coimbatore - 642001")
# {'flat': '14/2', 'building': '', 'street': 'Gandhi Road', 'landmark': '', 'area': 'Pollachi',
# 'city': 'Coimbatore', 'state': 'Tamil Nadu', 'pincode': '642001', 'phone': ''}
The model is abr-6024/indian-address-parser-1.5B, a fine-tune of Qwen2.5-1.5B-Instruct, run through llama.cpp as a GGUF file.
Install
pip install india-address-parser
The first call downloads the model (Q4_K_M, about 1 GB) from Hugging Face and caches it. After that it runs offline.
llama-cpp-python is installed as a dependency. If pip has to compile it and fails, install a prebuilt CPU wheel first:
pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
Use
from india_address_parser import AddressParser
p = AddressParser() # loads the model once
p.parse("Flat 3B, Sri Murugan Apartments, Peelamedu, Coimbatore 641004, 9442012345")
p.parse_many(["12, Mettu Street, Karaikudi, Sivaganga District 630001", "..."])
AddressParser(model_path="my.gguf") # use a local GGUF file instead of downloading
Command line:
india-address-parser "No 21, East Car Street, Srirangam, Tiruchirappalli 620006"
cat addresses.txt | india-address-parser # one address per line, one JSON object per line out
Every result has exactly these keys: flat, building, street, landmark, area, city, state, pincode, phone.
Anything not written in the address is an empty string.
Conventions
cityis the district name (or the metro name for big cities), not necessarily the town written in the address.areais the locality, village or post-office name.flatis the door or house number only.- The model does not guess a city that is not written. It fills the state when the city or pincode implies it.
Accuracy and limits
The default file (Q4_K_M) scored 94.0% full-record exact match on 200 random synthetic test addresses, 29 of 30 on a hand-written Tamil Nadu set and 28 of 36 on a hand-written mixed-India set. The original unquantized model scored 94.4% on all 800 synthetic test addresses. The hand-written sets were written by the model's author, so they are not independent benchmarks. Details: GGUF model card.
- The model was trained on synthetic address text over real India Post geography. Accuracy on real customer addresses has not been measured and is likely lower. Test it on your own data before relying on it.
- Bare-number addresses such as
15 Gandhi Salai, Tirupurcan lose the house number. - Pincodes are extracted, not validated against the locality. English / Latin script only.
parseraisesValueErrorif the model does not return a JSON object. Handle that in production code.
Credits and license
Code: Apache-2.0. Base model: Qwen2.5-1.5B-Instruct (Apache-2.0). Training geography: All India Pincode Directory, Department of Posts, Government of India (data.gov.in, GODL-India).
Metadata
Release files for india-address-parser 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| india_address_parser-0.1.0.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| india_address_parser-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / india_address_parser-0.1.0.tar.gz
| Download URL | india_address_parser-0.1.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
886e4a61fb8757b7f3a7a4c7d51116ee87a5b3ffef64c1d9692610e7786aa09b
|
|
BLAKE2b-256 checksum How to use checksums |
3ed3beee9d564d4d539bfc373f9319c1de25f9dc1ca984397b27ff0ad5ea7507
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.6
|
Release files / india_address_parser-0.1.0-py3-none-any.whl
| Download URL | india_address_parser-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50f11369ba1bbe250f55281326f55d92ad7d00f1f6d34f451cf22598c212ff58
|
|
BLAKE2b-256 checksum How to use checksums |
aca91dcdd880ff4630402150967a1268dabbcc875d0bde9290d2bddf6316cc1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.6
|