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
This commit is contained in:
parent
1751171667
commit
580d2ed5b8
2 changed files with 470 additions and 218 deletions
36
tools/dict_compiler/download_dicts.sh
Executable file
36
tools/dict_compiler/download_dicts.sh
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/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/"
|
||||
Loading…
Add table
Add a link
Reference in a new issue