Spaces:
Sleeping
Sleeping
File size: 1,296 Bytes
57cf043 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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
|