Divers, en lien avec DMI04 (gemini_for_enonce.py, smaller images, link to enonce.pdf)
This commit is contained in:
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user