Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Library to parse and validate Vietnamese vehicle plate

Project description

Library to validate and parse Vietnamese vehicle plate.

This library is not a computer-vision-based license plate recognition software. It instead is used for validating output of such computer vision software. Imagine that you use camera to track all cars coming in and out of your parking lot, but you don’t want to save false data generated from recognition process (due to wrong angle of canera, for example).


pip3 install biensoxe


Call VietnamVehiclePlate.from_string, passing the number string, to create VietnamVehiclePlate object.

>>> from biensoxe import VietnamVehiclePlate

>>> VietnamVehiclePlate.from_string('44A-112.23')
VietnamVehiclePlate(compact='44A11223', vehicle_type=<VehicleType.DOMESTIC_AUTOMOBILE: 1>,
series='A', order='11223', locality='44', dip_country=None)

The method raises ValueError if the string could not be parsed.

To format the plate number as in daily life, pass VietnamVehiclePlate to str:

>>> plate = VietnamVehiclePlate.from_string('72E101130')

>>> plate
VietnamVehiclePlate(compact='72E101130', vehicle_type=<VehicleType.DOMESTIC_MOTORCYCLE_50_TO_175CC: 3>, series='E1', order='01130', locality='72', dip_country=None)

>>> str(plate)
'72-E1 011.30'


This library provides a field type, VietnamVehiclePlateField, for Django model. The field will return value as VietnamVehiclePlate object. Here is example:

from biensoxe.django import VietnamVehiclePlateField

def default_plate_number():
    return VietnamVehiclePlate.from_string('10A 00001')

class Vehicle(models.Model):
    plate_number = VietnamVehiclePlateField(max_length=20, default=default_plate_number, unique=True)

def __str__(self):
    return str(self.plate_number) or

Note that this field stores value internally as PostgeSQL CIText data type, so you can only use this field with PostgreSQL. You also need to activate CITextExtension your self.

Download files

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

Files for biensoxe, version 0.8.4
Filename, size File type Python version Upload date Hashes
Filename, size biensoxe-0.8.4-py3-none-any.whl (7.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size biensoxe-0.8.4.tar.gz (6.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page