Imposta la LLM-wiki: sposta i grezzi in raw/, riscrive CLAUDE.md, genera le note figura
- Sposta tesi.md, immagini, cataloghi e schede fonti in raw/ (immutabile); rimuove CHANGELOG, tesi.pdf e tesi.docx
- Riscrive CLAUDE.md: dominio, regole sui dati, ingest per capitolo, tesi_loc
- Aggiunge scripts/gen_figures.py e le 78 note in wiki/figures/ da raw/immagini.json
- Aggiunge index.md, log.md, wiki/tesi.md (mappa) e le cartelle wiki/{compounds,techniques,concepts,analyses}
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8e191ff07b
commit
0f495b198e
237 files changed
+3517
-60
No files matched your search
@@ -0,0 +1,69 @@
|
||||
"""Genera wiki/figures/<id>.md da raw/immagini.json. Nessun riassunto: ogni campo del catalogo viene riportato.
|
||||
Uso: python scripts/gen_figures.py (rigenera tutto; le note sono derivate, non si modificano a mano)."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
cat = json.loads((root / "raw/immagini.json").read_text(encoding="utf8"))
|
||||
out = root / "wiki/figures"
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def q(s):
|
||||
return json.dumps(str(s), ensure_ascii=False)
|
||||
|
||||
|
||||
def lst(xs):
|
||||
return "[" + ", ".join(q(x) for x in xs) + "]"
|
||||
|
||||
|
||||
for f in cat["figures"]:
|
||||
loc, qual = f["location"], f["quality"]
|
||||
f["label"] = f.get("label") or f["id"] # figure senza numero stampato
|
||||
v = qual.get("verification") or {}
|
||||
tesi_loc = f"§{loc['section']} r.{loc['md_line']}"
|
||||
fm = [
|
||||
"---",
|
||||
f"title: {q(' - '.join(x for x in (f['label'], f.get('title') or f.get('caption_printed')) if x))}",
|
||||
"type: figure",
|
||||
f"id: {f['id']}",
|
||||
f"tipo: {f['type']}",
|
||||
f"capitolo: {q(loc['chapter'])}",
|
||||
f"sezione: {q(loc['section'])}",
|
||||
f"tesi_loc: {q(tesi_loc)}",
|
||||
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', []))}",
|
||||
f"verifica: {v.get('verdict', 'n/d')}",
|
||||
"derivata: true",
|
||||
"---",
|
||||
"",
|
||||
]
|
||||
body = [f"# {f['label']}", ""]
|
||||
body += [f"**Didascalia stampata (testo della tesi):** {f.get('caption_printed') or 'n/d'}", ""]
|
||||
cap = f", didascalia r.{loc['caption_md_line']}" if loc.get("caption_md_line") else ""
|
||||
body += [f"_Posizione: tesi.md {tesi_loc} (sezione {loc['section']} {loc['section_title']}){cap}_", ""]
|
||||
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 tesi.md alle righe: " + ", ".join(map(str, f["cited_in_md_lines"])), ""]
|
||||
if qual.get("review_notes"):
|
||||
body += ["## Da verificare", qual["review_notes"], ""]
|
||||
if v.get("issues"):
|
||||
body += ["Esito revisione indipendente: " + "; ".join(v["issues"]), ""]
|
||||
body += ["## Collegamenti", "- [[tesi]]", ""]
|
||||
(out / f"{f['id']}.md").write_text("\n".join(fm + body), encoding="utf8")
|
||||
|
||||
print(f"{len(cat['figures'])} note in {out}")
|
||||
Reference in new issue
Block a user