spiegel-keyman/common/predictive-text
Marc Durdin 0d4a6e428a fix(windows): base layout support in Keyman Core
While Keyman Core already supported the base layout flags, they were not
being passed in from Keyman Engine for Windows. This meant that any
rules that used `baselayout` would fail, such as in sil_ipa with AltGr+0
for }

0bf72bed74/release/sil/sil_ipa/source/sil_ipa.kmn (L348-L350)

This patch adds support for the following properties:

* KM_KBP_KMX_ENV_BASELAYOUT: the legacy base layout name, e.g. kbdus.dll
* KM_KBP_KMX_ENV_BASELAYOUTALT: the BCP 47 base layout name, e.g. en-US
* KM_KBP_KMX_ENV_SIMULATEALTGR: whether the user has selected to emulate
  AltGr with Ctrl+Alt, for example on laptops without a right alt key.
* KM_KBP_KMX_ENV_BASELAYOUTGIVESCTRLRALTFORRALT: whether the system base
  layout in use generates Ctrl+RAlt when RAlt is pressed, which can be
  true for many European system layouts. This is necessary when
  associating the keyboard with a European language because the base
  keyboard becomes the language's default keyboard, rather than kbdus.
2022-11-14 12:27:04 +11:00
..
docs docs(common/models): Update common/predictive-text/docs/worker-communication-protocol.md 2020-12-04 08:26:32 +07:00
polyfills fix(common/models): method name typo 2020-12-14 09:28:58 +07:00
testing fix(windows): base layout support in Keyman Core 2022-11-14 12:27:04 +11:00
unit_tests chore(web): Merge branch 'beta' into change/web/browser-test-timeouts 2022-06-06 12:51:23 +07:00
worker fix(web): missed niche scenario - first word of context, post backspace 2022-04-29 09:43:05 -05:00
.gitignore fix(common): Actually adds polyfill (and fixes .gitignore) 2019-12-10 09:24:23 +07:00
browser.tsconfig.json refactor(common/lmlayer): Adapts to rework of base PR 2020-04-17 11:18:13 +07:00
build.sh chore(common/models): adds a naive... semi-fill?... for String.normalize for old devices 2020-12-14 09:26:36 +07:00
embedded_worker.d.ts Merge branch 'lmlayer-init' into lmlayer-build-reorg 2018-11-29 23:35:37 +07:00
index.d.ts Merge branch 'web-lmlayer-model-registration' into lmlayer-wordbreak-spec 2019-03-07 09:04:00 +07:00
index.ts fix(common/core/web): predictive context reset 2020-12-03 15:48:18 +07:00
message.d.ts feat(common/models): reversion in lm-layer 2020-10-08 15:15:55 +07:00
node-defaultWorker.ts refactor(common/lmlayer): Adapts to rework of base PR 2020-04-17 11:18:13 +07:00
package-lock.json auto: increment stable-15.0 version to 15.0.273 2022-11-01 23:07:55 -04:00
package.json auto: increment stable-15.0 version to 15.0.273 2022-11-01 23:07:55 -04:00
promise-store.ts change(android): gets API 23 working again, but not 19 or 21 (yet) 2019-12-02 07:55:37 +07:00
README.md feat(common): lerna now npm-installed locally 2020-04-21 15:55:43 +07:00
tsconfig.json refactor(common/lmlayer): Adapts to rework of base PR 2020-04-17 11:18:13 +07:00
virtualizedWorker.ts change(common/lmlayer): a bit more PR review polish 2020-04-20 23:18:22 +07:00
web-defaultWorker.ts refactor(common/lmlayer): Adapts to rework of base PR 2020-04-17 11:18:13 +07:00
worker-interface.d.ts change(common/lmlayer): a bit more PR review polish 2020-04-20 23:18:22 +07:00

Language Modelling Layer (LMLayer)

Provide predictions and corrections while you type!

See Worker Communication Protocol for a semi-formal specification on how the Worker and the main thread communicate.

System dependencies

You will need Bash and Node.js >= 10.0.

Build

Run build.sh. This will also automatically install dependencies with npm.

./build.sh

Two-stage compilation process

Since the primary LMLayer code runs within a Web Worker, build.sh compiles the LMLayer in two stages:

  1. Compile the inner worker code

    1. Compile the TypeScript sources for only the Worker code.
    2. Wrap the Worker code as embedded_worker.js
  2. Compile the top-level code

    1. Include embedded_worker.js verbatim using a TypeScript directive.
    2. Compile the top-level TypeScript code.
    3. Unwrap the Worker code at runtime.

Test

This will run both headless unit tests, and in-browser unit tests and integration tests:

./build.sh -test

Test-Driven Development

I like to use entr to automatically build and re-run the unit tests anytime I change a source code file. Here's the command I run in separate window:

git ls-files | entr -c ./build.sh -tdd

Importantly, ./build.sh -tdd skips running the in-browser tests, and skips downloading/updating npm dependencies.