Add configurable offline layout correction and latest Windows release

This commit is contained in:
2026-10-27 23:50:04 +02:00
parent f683e4178c
commit f1af998029
25 changed files with 142458 additions and 27 deletions
+54 -1
View File
@@ -117,6 +117,58 @@ Alternatively open this directory as a CMake project in Visual Studio with the C
and Windows SDK installed, or use CMake with a Windows GCC toolchain. CMake/MSVC is provided but the
verified local build uses GCC/w64devkit.
## Automatic layout correction (experimental)
Enable **Automatically correct layout (experimental)** in Settings, then use **Auto-correction
options…** to select dictionary languages and edit excluded applications or words to never correct.
The feature is off by default. English and Ukrainian are selected initially; Russian is optional.
Target layouts must also be enabled in the layout cycle.
**Characters before a word** and **Characters after a word** configure punctuation to preserve around
the corrected word. Enter characters directly, without spaces or separators; a comma or semicolon
is itself a character. Defaults include parentheses, square/curly brackets, quotation marks and common
trailing punctuation, including colon and semicolon. Empty fields disable stripping on that side.
Up to three leading and six trailing characters (including the final space) are supported. Recognition
still requires a verified complete word; punctuation inside a word is not stripped. Correction runs
after Space, not immediately after a punctuation key. Save Settings to apply changes.
**Frequency rank limit** defaults to **0 (entire dictionary)**. A positive value allows corrections
only to words with a rank at or below that number (for example, 10000). All dictionary words still
protect already valid input, and ambiguous alternatives remain unchanged regardless of this limit.
**Open dictionary folder** opens the files beside the running executable. After editing, click OK
in the options window and Save in Settings to validate and reload the dictionaries without restarting.
Use UTF-8, one lowercase word followed by a Tab and a positive rank per line; keep words sorted and
unique. For a personal addition, rank 1 makes it eligible at every positive limit. Back up your edited
files before replacing dictionaries with a new distribution.
After Space and a 250 ms typing pause, KSwitcher checks the last physically typed word against local
dictionaries. For example, `ghbdsn ` can become `привіт `. Continuing to type cancels pending work.
It only corrects unknown words when exactly one alternative is a dictionary word.
**Minimum word length** defaults to 3 and can be set from 1 to 32 letters. Surrounding punctuation
does not count toward this minimum; the maximum word length is 32 letters.
Known words, ambiguous alternatives, ALL CAPS, mixed-case identifiers, numbers, URLs and email
addresses are left unchanged. Short trailing punctuation is retained when the editor selects it
together with the word. Actual selected text is verified before replacement. Layout switching follows
the existing switch-layout setting. The configured Undo shortcut restores the original and suppresses
that word for the rest of the session (until restart).
Password fields and inaccessible controls are skipped using Windows UI Automation. Editors, terminals
and password managers are excluded by default; process names can be edited in the options window.
Controls that do not expose an editable/document element or cannot select a complete word may not
support automatic correction. Dictionary recognition is heuristic, not an understanding of the sentence;
subtitle vocabulary is incomplete, and uncommon names or jargon can need personal exceptions.
No network service or language model is used. The three dictionary files occupy about 2.6 MB on disk;
the English/Ukrainian lookup data uses less than 3 MiB of RAM and is loaded on first automatic check.
Keep `dictionaries/` beside the executable when copying the app. These word lists derive from
[FrequencyWords](https://github.com/hermitdave/FrequencyWords) and are separately licensed under
CC BY-SA 4.0; attribution, pinned source revision and license are in `dictionaries/`.
## Latest compiled release
The [Release folder](Release/README.md) contains the latest portable Windows x64 ZIP and SHA-256 checksum.
Run `./package.ps1 -PublishRelease` after building and testing to refresh the tracked release archive.
## Verification
```powershell
@@ -143,4 +195,5 @@ It still uses the normal instance lock; close a running KSwitcher first if measu
- `ocr.*`: Windows WIC and OCR via the native Windows Runtime ABI.
- `tests/`: regression checks, real editor integration and OCR fixture.
MIT licensed; preserves the original Typlo attribution in `LICENSE`.
Application code is MIT licensed; preserves the original Typlo attribution in `LICENSE`.
Dictionary data has its own CC BY-SA 4.0 license as described above.