This trie implementation allows for word forms to be converted to keys.
Since keys do not have to have the exact same spelling, capitalization,
or even Unicode normalization form as the desried word form, this
enables a somewhat search for word forms based on prefixes.
The implementation was at one point Conrad Irwin's trie-ing,
<
|
||
|---|---|---|
| .. | ||
| docs | ||
| testing | ||
| unit_tests | ||
| worker | ||
| .gitignore | ||
| build.sh | ||
| embedded_worker.d.ts | ||
| history.md | ||
| index.d.ts | ||
| index.ts | ||
| message.d.ts | ||
| package-lock.json | ||
| package.json | ||
| promise-store.ts | ||
| README.md | ||
| tsconfig.json | ||
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 >= 6.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.