zmk-javelin-steno/tools/dict_compiler/download_dicts.sh
afiqzudinhadi 580d2ed5b8 Phase 3b: working dict compiler + dict download script
- compile_dict.py: full JSC4 binary compiler for compact map dicts.
  Parses Plover JSON → builds hash maps with CRC32 probing →
  produces binary with correct header, pointers, text block, timestamps.
  Tested with small dict — magic + timestamp validation passes.
- download_dicts.sh: fetches Plover main.json from openstenoproject/plover
  and Lapwing dicts from aerickt/plover-lapwing-aio.

Usage: python compile_dict.py main.json -o dicts/steno_dict.bin
2026-06-22 21:52:57 +08:00

36 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Download Plover and Lapwing steno dictionaries from their official repos.
# Usage: ./download_dicts.sh [plover|lapwing|all] [output_dir]
set -euo pipefail
THEORY="${1:-all}"
OUTDIR="${2:-./dicts_src}"
mkdir -p "$OUTDIR"
download_plover() {
echo "Downloading Plover main.json..."
curl -fsSL \
"https://raw.githubusercontent.com/openstenoproject/plover/main/plover/assets/main.json" \
-o "$OUTDIR/plover-main.json"
echo " $(python3 -c "import json; print(len(json.load(open('$OUTDIR/plover-main.json'))))" 2>/dev/null || echo '?') entries"
}
download_lapwing() {
local BASE="https://raw.githubusercontent.com/aerickt/plover-lapwing-aio/main/plover_lapwing/dictionaries"
echo "Downloading Lapwing dictionaries..."
for f in lapwing-base lapwing-commands lapwing-numbers; do
curl -fsSL "$BASE/$f.json" -o "$OUTDIR/$f.json"
echo " $f.json: $(python3 -c "import json; print(len(json.load(open('$OUTDIR/$f.json'))))" 2>/dev/null || echo '?') entries"
done
}
case "$THEORY" in
plover) download_plover ;;
lapwing) download_lapwing ;;
all) download_plover; download_lapwing ;;
*) echo "Usage: $0 [plover|lapwing|all] [output_dir]"; exit 1 ;;
esac
echo "Done. Dictionaries saved to $OUTDIR/"