spiegel-keyman/common/predictive-text
Eddie Antonio Santos 7c8f337238
Merge pull request #3014 from keymanapp/change/common/lmlayer/remove-nfd-table
change(common/lmlayer): remove NFD table
2020-04-23 08:49:18 -06:00
..
docs fix(common): model specification for isRTL 2020-01-30 14:23:31 +07:00
polyfills fix(common): Actually adds polyfill (and fixes .gitignore) 2019-12-10 09:24:23 +07:00
testing Demonstrate Blob code proof-of-concept. 2018-11-20 11:12:05 -07:00
unit_tests Merge pull request #2987 from keymanapp/refactor/common/lmlayer/headless-variant 2020-04-21 09:17:20 +07:00
worker Merge pull request #3014 from keymanapp/change/common/lmlayer/remove-nfd-table 2020-04-23 08:49:18 -06: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 refactor(common/lmlayer): reorganizes build script 2020-04-21 08:42:20 +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/lmlayer): fixes integrated unit tests 2020-04-17 09:57:35 +07:00
message.d.ts feat(lmlayer): adds basic error reporting from worker 2019-12-02 07:55:37 +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 fix(common): adds string.startswith polyfill to lmlayer 2019-12-16 08:16:55 +07:00
package.json fix(common): adds string.startswith polyfill to lmlayer 2019-12-16 08:16:55 +07: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 Move npm link . to dependent build.sh scripts. 2019-10-01 14:55:58 -06: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.