mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-17 16:34:48 -05:00
Three fixes addressing user feedback from Peter (EAIF/NMC WG): Visual questions: SVGs were never mirrored from vault/visuals/ to public/question-visuals/, causing 404s on all platforms (not Chrome-specific). Added mirror-visuals.sh standalone script and wired it as a fallback in build-local-corpus.mjs so npm run dev always populates the 236 SVGs. Glossary tooltips: Parsed 831 terms from MLSysBook vol1/vol2 glossaries into glossary.json. New GlossaryText component annotates acronyms (92 matchable patterns) with hover tooltips showing expansion and definition. Wired into scenario text and MarkdownText so questions, solutions, and common-mistake text all get inline acronym hover. Uses existing MetaTooltip component (accessible, pure CSS, keyboard-focusable). First occurrence only per render to avoid clutter. Rubric quality: Replaced naive first-3-sentences extraction with a scoring system that prioritizes sentences containing technical terms, causal reasoning, and quantitative claims. Better filler removal and smarter common-mistake sentence selection.
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# mirror-visuals.sh — Copy SVG visuals from the vault to public/question-visuals/
|
|
#
|
|
# Standalone fallback for the `vault build --local` SVG mirroring step.
|
|
# Runs without the vault CLI (pip install -e interviews/vault-cli).
|
|
#
|
|
# Usage:
|
|
# interviews/staffml/scripts/mirror-visuals.sh
|
|
#
|
|
# The script auto-detects its own location and resolves paths relative to the
|
|
# repo root, so it works from any working directory.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
STAFFML_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
VAULT_VISUALS="$(cd "$STAFFML_DIR/../../interviews/vault/visuals" 2>/dev/null && pwd)" || {
|
|
echo "[mirror-visuals] ERROR: Cannot find interviews/vault/visuals/ relative to this script." >&2
|
|
exit 1
|
|
}
|
|
|
|
TARGET_DIR="$STAFFML_DIR/public/question-visuals"
|
|
TRACKS=(cloud edge mobile tinyml)
|
|
total=0
|
|
|
|
for track in "${TRACKS[@]}"; do
|
|
src="$VAULT_VISUALS/$track"
|
|
dst="$TARGET_DIR/$track"
|
|
|
|
if [ ! -d "$src" ]; then
|
|
echo "[mirror-visuals] WARN: source directory missing: $src" >&2
|
|
continue
|
|
fi
|
|
|
|
mkdir -p "$dst"
|
|
|
|
count=0
|
|
for svg in "$src"/*.svg; do
|
|
[ -f "$svg" ] || continue
|
|
cp "$svg" "$dst/"
|
|
count=$((count + 1))
|
|
done
|
|
|
|
total=$((total + count))
|
|
echo "[mirror-visuals] $track: $count SVGs"
|
|
done
|
|
|
|
echo "[mirror-visuals] done — $total SVGs mirrored to public/question-visuals/"
|