Improved Auto-Correct Algorithm

To be honest I used chatGPT to develop this algorithm but I thought about the concept on my own after accidently typing the word “urd” which obviously was a typo for the word “yes”. After that simple mistake I got the idea to create some type of algorithm that takes clumps of gibberish letters and looks at the QWERTY keys next to them and than runs all probable combinations of words and sentences trying to decode random lines of gibberish.

Neighbor Key Mapping Project

Concept

  • We treat each token (word-like chunk) as scrambled text.

  • Scrambling is done by substituting each character with a neighboring key on a QWERTY keyboard.

  • Two versions of mapping rules:

    • Omnidirectional: includes up, down, left, right, diagonals.

    • Left/Right Only: restricted to immediate horizontal neighbors.

Process

  1. Break the scrambled input into tokens.

  2. For each token, generate all possible neighbor mappings (based on chosen rule).

  3. Compare generated candidates against real dictionary words.

  4. Assemble the most plausible sentence by combining candidates with:

    • Lowest total neighbor-distance cost

    • Highest word frequency / plausibility

    • Sentence-level coherence

Example (Omnidirectional Mapping)

Input: gjs nkkm kzbxkbv qzd gsjd

  • Anchored token: nkkm = moon

  • Output: “the moon landing was fake” (best candidate)

Example (Left/Right Only Mapping)

Input: okst dpnr mre dpmh mpe

  • Token 1: okstplay

  • Token 2: dpnrsome

  • Token 3: mrenew

  • Token 4: dpmhsong

  • Token 5: mpenow

  • Output: “play some new song now”

Key Points

  • Token = any scrambled word-like chunk separated by spaces.

  • Neighbor mapping can be tuned to left/right only or all directions.

  • Final decoding balances keyboard-distance plausibility with natural language plausibility.

Applications

  • Error correction for typing mistakes.

  • Decoding scrambled or cipher-like input.

  • Fun puzzle generation and solving.

Great Idea! In fact you’ll find references to it online like this one:

In fact, there are enough examples of this keyboard transposition issue that you’ll find GPT even guesses what’s wrong if you type a transposed sentence. But I don’t know of any products that do this as their specific purpose!