Skip to content

Commit 088b974

Browse files
nodeeeeeeclaude
andcommitted
Promote master deck over per-day annotation snapshot in alignment
Profs often export a short per-session annotated PDF (e.g. Lecture5.ann070426.pdf containing the 10 slides discussed that day with handwritten marks) alongside the master Lecture5.pdf. bge-m3 preferentially matches the snapshot — its content overlaps most tightly with that day's transcript — so note generation ends up with a single 10-slide chunk instead of a full ~40-slide, multi-section pass over the lecture topic. After picking any slide, check for a .annYYYYMMDD.pdf suffix; if the stripped sibling exists, swap to it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d5b9fc2 commit 088b974

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

semantic_alignment.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,30 @@ def process_course(course_id: int | str, use_jina: bool = False,
19191919
# ── Priority 3: BGE-M3 embedding match ──────────────────────
19201920
slide_group = bge_matches[cap.stem]
19211921
print(f" [bge-m3] {cap.name}{[s.name for s in slide_group]}")
1922+
1923+
# Prefer the master lecture deck over per-day annotation
1924+
# snapshots. Profs often export per-session annotated PDFs
1925+
# (e.g. `Lecture5.ann070426.pdf` → only the 10 slides discussed
1926+
# that day) alongside the full `Lecture5.pdf`. bge-m3 matches
1927+
# the snapshot because its content overlaps most tightly with
1928+
# one day's transcript, but students want notes against the
1929+
# full scope. If the picked file has a `.annYYYYMMDD.pdf`
1930+
# style suffix and a sibling without that suffix exists, swap
1931+
# to the sibling.
1932+
if slide_group:
1933+
promoted: list[Path] = []
1934+
for sp in slide_group:
1935+
m = re.match(r"^(.+)\.ann\d{4,8}$", sp.stem)
1936+
if m:
1937+
main_path = sp.with_name(f"{m.group(1)}{sp.suffix}")
1938+
if main_path.exists() and main_path != sp:
1939+
print(f" [promote] {sp.name}{main_path.name} "
1940+
f"(full deck preferred over per-day annotation)")
1941+
promoted.append(main_path)
1942+
continue
1943+
promoted.append(sp)
1944+
slide_group = promoted
1945+
19221946
if not slide_group:
19231947
# ── Priority 4: mpnet content embedding fallback ─────────────
19241948
if embedder is None:

0 commit comments

Comments
 (0)