Divers, en lien avec DMI04 (gemini_for_enonce.py, smaller images, link to enonce.pdf)

This commit is contained in:
2026-05-09 16:26:01 +02:00
parent 8d9165d0ac
commit 0836d5809d
9 changed files with 202 additions and 59 deletions
+4 -8
View File
@@ -5,20 +5,16 @@ def natural_key(text):
return [int(c) if c.isdigit() else c.lower() for c in re.split(r'(\d+)', str(text))]
def read_all_labels(base_dir):
# return sorted(list(filter(None,
# (Path(base_dir) / "labels").read_text().splitlines())),
# key = natural_key)
return list(filter(None, (Path(base_dir) / "labels").read_text().splitlines()))
return sorted(list(filter(None,
(Path(base_dir) / "labels").read_text().splitlines())),
key = natural_key)
def enonce_total(base_dir):
text_dir = Path(base_dir) / 'Text'
if not text_dir.is_dir():
return ""
# Exclude .tex and .pdf files
files = [f for f in text_dir.iterdir()
if f.is_file() and f.suffix.lower() not in ('.tex', '.pdf')]
files = [f for f in text_dir.iterdir() if f.is_file()]
files.sort(key=lambda f: natural_key(f.name))
output = []