spiegel-keyman/common/predictive-text
2023-10-04 12:55:51 +07:00
..
docs chore(common): use /usr/bin/env bash 2022-07-25 14:59:37 +10:00
src fix(common/models): forgot about setting needed for Node worker use 2023-06-14 10:12:48 +07:00
unit_tests fix(web): fixed mocha test paths for lm-layer tests 2023-06-15 11:00:19 +07:00
.build-builder chore(common/models): minor tweaks per review 2022-10-05 09:04:23 +07:00
.gitignore Revert "chore(web): merge master into feature-esmodule-web-engine (A17S9 end) 🧩" 2023-03-31 14:17:37 +11:00
build-bundler.js chore(web): partial centralization of common/web KMW module bundling config 2023-06-15 10:33:29 +07:00
build.sh chore(web): Merge branch 'chore/web/cleanup-kmw-headless-module-builds' into chore/web/esbuild-config-cleanup 2023-06-16 12:47:20 +07:00
package.json chore(web): cleanup re set_keyman_standard_build_path 2023-06-14 10:00:39 +07:00
README.md feat(common): lerna now npm-installed locally 2020-04-21 15:55:43 +07:00
tsconfig.all.json chore(web): kmw-main tsconfig -> /web, redirect in /common/web 2023-06-14 08:22:05 +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.