Ingest del riassunto di tesi: mappa, confronto con la tesi, registro delle affermazioni e note delle 11 figure

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5.5 committed 2026-10-20 13:50:48 +02:00
1 parent 6a37df0c80
commit aa9b943450
24 files changed
+763 -15

No files matched your search

+55 -1
View File
@@ -68,7 +68,55 @@ for f in cat["figures"]:
body += ["## Collegamenti", "- [[tesi]]", ""]
(out / f"{f['id']}.md").write_text("\n".join(fm + body), encoding="utf8")
# --- figure del riassunto di tesi (chiave "riassunto" di immagini.json): note ris-fig-NN.md ---
ris = cat.get("riassunto", {}).get("figures", [])
for f in ris:
qual = f["quality"]
fm = [
"---",
f"title: {q(' - '.join(x for x in (f['label'], f.get('title')) if x))}",
"type: figure",
f"id: {f['id']}",
f"tipo: {f['type']}",
'documento: "riassunto"',
f"tesi_loc: {q('riassunto r.' + str(f['location']['md_line']))}",
f"composti: {lst(f.get('compounds', []))}",
f"concetti: {lst(f.get('concepts', []))}",
f"keywords: {lst(f.get('keywords', []))}",
f"confidence: {qual['confidence']}",
f"flags: {lst(qual.get('flags', []))}",
"derivata: true",
"---",
"",
]
loc = f["location"]
body = [f"# {f['label']} (riassunto di tesi)", ""]
body += [f"**Didascalia stampata (testo del riassunto):** {f['caption_printed']}", ""]
body += [f"_Posizione: riassunto_tesi.md r.{loc['md_line']}, didascalia r.{loc['caption_md_line']}_", ""]
body += ["> Sotto: contenuto generato guardando l'immagine, non verificato una per una.", ""]
body += [f"**Didascalia generata:** {f['caption']}", ""]
for p in f["panels"]:
body += [p["embed"], ""]
body += [f"- Pannello: {p['panel'] or 'unico'} · file `{p['file']}` · {p['width']}×{p['height']} · confidence {p['confidence']}"]
body += [f"- Descrizione: {p['description']}"]
body += ["- Testo visibile: " + (" · ".join(p["visible_text"]) or "n/d")]
if p.get("quality_flags"):
body += ["- Flag: " + ", ".join(p["quality_flags"])]
body += [""]
if f.get("text_context"):
body += ["## Contesto nel testo", f["text_context"], ""]
if f.get("cited_in_md_lines"):
body += ["Citata in riassunto_tesi.md alle righe: " + ", ".join(map(str, f["cited_in_md_lines"])), ""]
if f.get("thesis_equivalents"):
body += ["## Corrispondenze nella tesi"]
body += [f"- [[{e['id']}]] — {e['relation']} (verifica: {e['verified']})" for e in f["thesis_equivalents"]] + [""]
if qual.get("review_notes"):
body += ["## Da verificare", qual["review_notes"], ""]
body += ["## Collegamenti", "- [[riassunto-tesi]] · [[riassunto-vs-tesi]]", ""]
(out / f"{f['id']}.md").write_text("\n".join(fm + body), encoding="utf8")
print(f"{len(cat['figures'])} note in {out}")
print(f"{len(ris)} note del riassunto in {out}")
# --- wiki/figure-indice.md: indice derivato (sezione -> figure) ---
import re as _re
@@ -78,7 +126,7 @@ def _clean(s):
idx = ["---", "title: Indice delle figure", "type: overview", "tags: [figure, indice, navigazione]",
"created: 2026-10-15", "updated: 2026-10-15", 'tesi_loc: "r.73-1301 (didascalie)"', "derivata: true", "status: draft", "---", "",
"# Indice delle figure", "",
f"Le {len(cat['figures'])} figure del catalogo raggruppate per sezione della tesi (generata da `raw/immagini.json`: non modificare a mano). "
f"Le {len(cat['figures'])} figure del catalogo raggruppate per sezione della tesi, più le {len(cat.get('riassunto', {}).get('figures', []))} del riassunto di tesi in fondo (generata da `raw/immagini.json`: non modificare a mano). "
"Ogni voce rimanda alla nota della figura; ⚠ = figura con flag o note di revisione. Matrice campioni × tecniche: [[campioni]]; tabelle: [[tabelle-indice]].", ""]
by_sec = {}
for f in cat["figures"]:
@@ -95,6 +143,12 @@ for s in cat["sections"]:
else:
idx.append(f"- [[{f['id']}|schema]] — {_clean(f['caption'])} _({f['type']})_{warn}")
idx.append("")
if ris:
idx += ["## Riassunto di tesi", ""]
for f in ris:
warn = " ⚠" if (f["quality"].get("flags") or f["quality"].get("review_notes")) else ""
idx.append(f"- [[{f['id']}|Fig. {f['number']}]] — {_clean(f['title'])} _({f['type']})_{warn}")
idx.append("")
idx += ["## Collegamenti", "- [[index]] · [[tesi]] · [[campioni]] · [[tabelle-indice]]", ""]
(root / "wiki/figure-indice.md").write_text("\n".join(idx), encoding="utf8")
print("figure-indice.md generato")