spiegel-keyman/common/test/predictive-text
2019-04-16 11:17:26 -06:00
..
.gitignore Works as an event stream now! 2019-04-11 16:17:54 -06:00
index.js Implement the prediction protocol correctly. 2019-04-16 11:12:11 -06:00
package-lock.json Install executable globally. 2019-04-15 15:26:47 -06:00
package.json Install executable globally. 2019-04-15 15:26:47 -06:00
README.md Spruce up some things in README.md. 2019-04-16 11:17:26 -06:00

Predictive text testing CLI

Provides a command line interface to try out predictive text models.

Install

NOTE: Requires Node >= 10.0

Install locally with npm:

npm install

You can install globally like so:

npm install -g .

Usage

Start it like so:

$ ./index.js -f path/to/model.js  # local
$ lmlayer-cli . -f path/to/model.js  # global

You will be presented with a prompt. Type any phrase in the model's language.

  • Press Tab to start selecting a suggestion.
  • Press Tab again to select the next suggestion.
  • Press Shift+Tab to select the previous suggestion.
  • Press Enter to accept the selected suggestion.
  • Press Ctrl+C or Ctrl+D to quit.
> He
[Hello] [Hey] [He he]

Defining the LMPATH environment variable

You can also load models by their model ID. For example,

$ ./index.js example.en.model  # local
$ lmlayer-cli example.en.model  # global

For this to work, you need to define the LMPATH environment variable. The CLI will search the directory specified in LMPATH to find the particular model.

For example, say you have lexical-models cloned in your home directory. To be able to access any of the release build lexical models, export the LMPATH variable as follows:

export LMPATH="${HOME}/lexical-models/release"

This line usually goes in your shell startup file, e.g., ~/.bashrc, ~/.bash_profile, or ~/.zshrc, etc.

Then, any lexical model built in ~/lexical-models/release can be used in the command line interface.