Spaces:
Sleeping
Sleeping
import os | |
from pathlib import Path | |
class DatasetPaths: | |
""" | |
Класс для хранения путей к файлам и директориям, задействованным при формировании датасета. | |
root_path: os.PathLike - корневая директория, в которой будет храниться датасет | |
save_intermediate_files: bool - флаг, указывающий, нужно ли сохранять промежуточные файлы, \ | |
которые используются только при формировании датасета | |
""" | |
def __init__( | |
self, | |
root_path: os.PathLike, | |
save_intermediate_files: bool = False, | |
): | |
self.root_path = Path(root_path) | |
self.abbreviations = self.root_path / 'abbreviations.csv' | |
self.xml_info = self.root_path / 'xml_info.csv' | |
self.dataset = self.root_path / 'dataset.pkl' | |
self.save_intermediate_files = save_intermediate_files | |
self.txt_path = self.root_path / 'txt' if save_intermediate_files else None | |
self.txt_abbr = self.root_path / 'txt_abbr' if save_intermediate_files else None | |
self.jsons_path = self.root_path / 'jsons' if save_intermediate_files else None | |