Skip to main content

Saudi vehicle plate parsing, normalization, validation, and formatting.

Project description

saudi-plate

A production-ready Python library for Saudi vehicle plate parsing, normalization, validation, formatting, and equality comparison.

Features

  • Parse raw user input from Arabic, Latin, or mixed script input
  • Normalize Arabic-Indic digits to ASCII for storage
  • Validate Saudi plate structure with strict, standard, and lenient modes
  • Format plates for canonical storage, English display, and Arabic display
  • Compare plate inputs by canonical identity
  • Typed public API and test suite included

Saudi letter mapping

This library uses the Saudi plate mapping, not general Arabic transliteration.

Arabic Latin Code
ا A ALIF
ب B BA
ح J HA
د D DAL
ر R RA
س S SIN
ص X SAD
ط T TA
ع E AIN
ق G QAF
ك K KAF
ل L LAM
م Z MIM
ن N NUN
ه H HAH
و U WAW
ي V YA

Installation

pip install saudi-plate

Quick start

from saudi_plate import normalize_plate, format_plate, validate_plate, FormatStyle

result = normalize_plate("١٢٣٤ ا ب ح")
assert result.success
assert result.canonical == "ABJ-1234"

print(format_plate("ABJ1234", FormatStyle.DISPLAY_AR))
print(validate_plate("1234 ABJ").is_valid)

API

normalize_plate(input, options=None)

Returns NormalizeResult with:

  • success
  • canonical
  • plate
  • corrections
  • errors
  • warnings

parse_plate(input, options=None)

Returns ParseResult with structural parsing results.

validate_plate(input, options=None)

Returns ValidationResult with is_valid, plate, and issues.

format_plate(input_or_plate, style=FormatStyle.CANONICAL, options=None)

Supported styles:

  • canonical
  • storage
  • display_en
  • display_ar
  • compact_en
  • compact_ar

equals(a, b, options=None)

Compares two inputs by canonical identity.

Strictness modes

Strict

  • No mixed Arabic and Latin letters
  • No digits-before-letters input
  • Exactly 4 digits required

Standard

  • Mixed scripts allowed
  • Reordered input allowed with warnings
  • 1 to 4 digits allowed

Lenient

  • Same acceptance policy as standard, intended for search and support tools

Development

pip install saudi_plate

Notes

  • The library is focused on text parsing and normalization, not OCR or registry lookup.
  • Canonical storage format is LATINLETTERS-DIGITS, for example ABJ-1234.

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

saudi_plate-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

saudi_plate-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file saudi_plate-0.1.0.tar.gz.

File metadata

  • Download URL: saudi_plate-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for saudi_plate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da03e910d95341a57a77a3c1df0d0a305102ca810392e1d9a757134f34dcaaba
MD5 01a7bd232a189b58fe83794b21f42c47
BLAKE2b-256 364fafc2e966500c2d260d4ddb9172ff2204de15ca94bcf8bada75b8b35396e6

See more details on using hashes here.

File details

Details for the file saudi_plate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: saudi_plate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for saudi_plate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81bf61df9aa71caa7d16e5599ab9b6d85205287b1a57ea382cc2c121fc0dbe0e
MD5 d6122c77ae1b408aedceaea3bfc55ce4
BLAKE2b-256 6399c1adfd45ed20fe71b5491be27306e8b34d12844cb8872b4e28d0edbc0e1f

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