-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocess.py
More file actions
70 lines (55 loc) · 1.69 KB
/
preprocess.py
File metadata and controls
70 lines (55 loc) · 1.69 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""L2-ARCTIC 데이터셋 전처리 및 분할."""
import argparse
import logging
from pathlib import Path
from LopeScript.DataProc.preprocessing import DatasetProcessor
from LopeScript.DataProc.data_split import split_dataset
def main():
parser = argparse.ArgumentParser(
description="L2-ARCTIC preprocessing and splitting"
)
parser.add_argument(
"--data_root",
type=str,
default="data/l2arctic",
help="L2-ARCTIC dataset root directory",
)
parser.add_argument(
"--output",
type=str,
default="data/preprocessed_perceived.json",
help="Output JSON file path",
)
parser.add_argument(
"--split_output_dir",
type=str,
default="data",
help="Directory for train/dev/test split files",
)
parser.add_argument(
"--verbose",
action="store_true",
help="Enable verbose logging",
)
args = parser.parse_args()
logging.basicConfig(
level=logging.DEBUG if args.verbose else logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
)
data_root = Path(args.data_root)
output_path = Path(args.output)
if not data_root.exists() or not data_root.is_dir():
logging.error(f"Data root not found: {data_root}")
return
output_path.parent.mkdir(parents=True, exist_ok=True)
processor = DatasetProcessor(str(data_root), str(output_path))
result = processor.process_all_files()
if not result:
logging.warning("Result is empty")
return
split_dataset(
input_path=str(output_path),
output_dir=args.split_output_dir
)
if __name__ == "__main__":
main()