Fixes #6455. This involved adding an extra hint to the data passed into the lexical model layer, being the CasingForm that the current layer wants to use. Given there are several entry points to the lexical model layer, this meant a few places where we needed to check the current layer. I refactored the very long function `InputProcessor.processKeyEvent` to extract out the `buildAlternates` function. There should be no functional changes to the `buildAlternates` code. But it makes `processKeyEvent` significantly easier to read. |
||
|---|---|---|
| .. | ||
| docs | ||
| polyfills | ||
| testing | ||
| unit_tests | ||
| worker | ||
| .gitignore | ||
| browser.tsconfig.json | ||
| build.sh | ||
| embedded_worker.d.ts | ||
| index.d.ts | ||
| index.ts | ||
| message.d.ts | ||
| node-defaultWorker.ts | ||
| package-lock.json | ||
| package.json | ||
| 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:
-
Compile the inner worker code
- Compile the TypeScript sources for only the Worker code.
- Wrap the Worker code as
embedded_worker.js
-
Compile the top-level code
- Include
embedded_worker.jsverbatim using a TypeScript directive. - Compile the top-level TypeScript code.
- Unwrap the Worker code at runtime.
- Include
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.