Installation

From Source

# Clone the repository
git clone https://github.com/asherp/glossia.git
cd glossia

# Install the binary (the CLI lives in the glossia-cli crate)
cargo install --path glossia-cli

This installs the glossia binary to ~/.cargo/bin/glossia (or $CARGO_HOME/bin/glossia if set). Make sure this directory is in your PATH.

Note: The repository is a Cargo workspace. The glossia crate at the root is the library; the glossia command-line binary is provided by the glossia-cli crate, and the developer tooling (POS tagging, weight validation, etc.) lives in glossia-tools.

From Git

cargo install --git https://github.com/asherp/glossia.git glossia-cli

Verify Installation

glossia --help

What Gets Installed

The English language files (wordlists, grammars, and type definitions) are embedded in the binary at compile time, so no additional files need to be copied. Other languages with YAML files in the languages/ directory are also embedded in release builds.

In debug builds, only English is embedded for faster compile times.

WebAssembly (Browser)

Glossia can be compiled to WebAssembly and run entirely in the browser.

Prerequisites

  • Rust toolchain (1.70+)
  • wasm-pack
  • (Optional) binaryen for wasm-opt size optimization

Build

./build_web.sh

This runs wasm-pack build --target web --no-default-features --features wasm, copies the resulting glossia.js and glossia_bg.wasm into the web/ directory, and optionally runs wasm-opt -Os if available.

Serve Locally

python3 -m http.server -d web 8080

Then open http://localhost:8080/index.html.

Manual Build

If you prefer to run the steps yourself:

wasm-pack build --target web --no-default-features --features wasm
mkdir -p web
cp pkg/glossia_bg.wasm web/
cp pkg/glossia.js web/

Requirements

  • Rust toolchain (1.70+)
  • For POS tagging tools: nlprule binary data files (en_tokenizer.bin, en_rules.bin)
  • For WASM builds: wasm-pack