MCPcopy
hub / github.com/hydropix/TranslateBooksWithLLMs / load_reference_texts

Function load_reference_texts

benchmark/data_loader.py:56–68  ·  view source on GitHub ↗

Load reference texts from the split layout, or the legacy YAML as fallback.

(
    base_dir: Path,
    legacy_file: Path,
)

Source from the content-addressed store, hash-verified

54
55
56def load_reference_texts(
57 base_dir: Path,
58 legacy_file: Path,
59) -> dict[str, ReferenceText]:
60 """Load reference texts from the split layout, or the legacy YAML as fallback."""
61 split_dir = _split_reference_texts_dir(base_dir)
62 if split_dir.is_dir():
63 return _load_reference_texts_split(split_dir)
64 if legacy_file.exists():
65 return _load_reference_texts_legacy(legacy_file)
66 raise FileNotFoundError(
67 f"No reference text data found. Looked in {split_dir} and {legacy_file}."
68 )
69
70
71def _iter_yaml_files(directory: Path) -> Iterable[Path]:

Callers 6

load_reference_textsMethod · 0.90
mainFunction · 0.90
load_tasksFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
_load_reference_textsMethod · 0.85

Calls 4

existsMethod · 0.45

Tested by

no test coverage detected