PHPackages                             jamiethompson/cikmov - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. jamiethompson/cikmov

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

jamiethompson/cikmov
====================

Deterministic UK postcode analysis and correction using constraint-based grammar rules.

v0.1.1(4mo ago)12MITPHPPHP ^8.2CI passing

Since Feb 13Pushed 4mo agoCompare

[ Source](https://github.com/jamiethompson/cikmov-php)[ Packagist](https://packagist.org/packages/jamiethompson/cikmov)[ RSS](/packages/jamiethompson-cikmov/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

cikmov
======

[](#cikmov)

Deterministic UK postcode analysis and correction for format-level validation.

Why This Library Exists
-----------------------

[](#why-this-library-exists)

UK postcodes are not free-form text. They are a constrained grammar designed for human use and machine sorting.

The system was designed to:

- support mechanical and automated sorting
- reduce transcription errors
- avoid visually ambiguous character patterns
- encode geography hierarchically
- remain human-readable

`cikmov` models these constraints directly in code and uses deterministic candidate generation plus rule filtering instead of fuzzy matching.

Constraint-Based, Not Fuzzy
---------------------------

[](#constraint-based-not-fuzzy)

This library intentionally does **not** use probabilistic matching, distance metrics, or fuzzy heuristics.

Why:

- postcode structure is finite and strongly constrained
- invalid candidates can be eliminated deterministically
- behaviour stays explainable, reproducible, and testable
- correction risk is lower when every decision is rule-backed

Shifted Number-Row Digit Support
--------------------------------

[](#shifted-number-row-digit-support)

`cikmov` supports deterministic correction when shifted number-row symbols are typed instead of digits.

Supported substitutions:

```
! -> 1
@ -> 2
" -> 2
# -> 3
£ -> 3
$ -> 4
% -> 5
^ -> 6
& -> 7
* -> 8
( -> 9
) -> 0

```

Scope rules:

- mapping is the union of UK + US number-row shifted symbols (including Irish usage of UK layout)
- no keyboard-layout detection is performed at runtime
- substitutions are attempted only where grammar requires digits:
    - outward digit positions
    - district digit positions
    - inward first character
- substitutions are not attempted in letter-only positions
- when stripping shifted symbols produces an already-valid compact postcode, symbols are treated as noise and not as digit substitutions

Public API
----------

[](#public-api)

```
