spiegel-keyman/common/predictive-text
2020-12-20 13:01:10 -05: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
unit_tests
worker fix(common/models): fixes post-wordbreak suggestions 2020-12-04 13:39:04 +07:00
.gitignore
browser.tsconfig.json
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
index.d.ts
index.ts fix(common/core/web): predictive context reset 2020-12-03 15:48:18 +07:00
message.d.ts
node-defaultWorker.ts
package-lock.json auto: increment beta version to 14.0.215 2020-12-20 13:01:10 -05:00
package.json auto: increment beta version to 14.0.215 2020-12-20 13:01:10 -05:00
promise-store.ts
README.md
tsconfig.json
virtualizedWorker.ts
web-defaultWorker.ts
worker-interface.d.ts

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.