-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
78 lines (58 loc) · 2.23 KB
/
main.py
File metadata and controls
78 lines (58 loc) · 2.23 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
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
"""
Main script to demonstrate the configuration system usage.
"""
import os
import sys
from config import ConfigReader, run_fact_check_experiment
def main():
"""
Main function
"""
# You can specify a different config file path if needed
config_file = "config.yml"
# Check if config file exists
if not os.path.exists(config_file):
print(f"❌ Configuration file '{config_file}' not found!")
print("Please create a config.yml file in the current directory.")
sys.exit(1)
try:
# Initialize the configuration reader
config_reader = ConfigReader(config_file)
# Load the configuration
config = config_reader.load_config()
if not config:
print("❌ Failed to load configuration!")
sys.exit(1)
# Validate the configuration
validation_result = config_reader.validate_config()
# Display validation results
config_reader.print_validation_results()
# Display the configuration beautifully
config_reader.print_configuration()
# Only proceed if configuration is valid
if validation_result.is_valid:
print("\n✅ Configuration is valid! Proceeding with experiment...")
# Run the fact-check experiment with the validated configuration
run_fact_check_experiment(config)
else:
print("\n❌ Configuration validation failed!")
print("Please fix the errors and warnings before running the experiment.")
# Print specific guidance
if validation_result.errors:
print("\n🔧 To fix errors:")
for error in validation_result.errors:
print(f" • {error}")
if validation_result.warnings:
print("\n⚠️ Warnings to consider:")
for warning in validation_result.warnings:
print(f" • {warning}")
sys.exit(1)
except KeyboardInterrupt:
print("\n\n🛑 Process interrupted by user.")
sys.exit(0)
except Exception as e:
print(f"\n❌ An unexpected error occurred: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()