import os | |
from pathlib import Path | |
# List of required files | |
required_files = [ | |
"coref_google_bert_uncased_L-12_H-768_A-12-v1.0.model", | |
"speaker_google_bert_uncased_L-12_H-768_A-12-v1.0.1.model", | |
"entities_google_bert_uncased_L-6_H-768_A-12-v1.0.model" | |
] | |
# Get the user's home directory | |
home_dir = str(Path.home()) | |
models_folder = os.path.join(home_dir, "booknlp_models") | |
# Check if the folder exists and all required files are present | |
if os.path.exists(models_folder): | |
missing_files = [file for file in required_files if not os.path.exists(os.path.join(models_folder, file))] | |
if missing_files: | |
print(f"The following files are missing: {', '.join(missing_files)}") | |
print("Please manually add the missing files to the 'booknlp_models' folder.") | |
else: | |
print("All required booknlp files are present. No action needed.") | |
else: | |
print(f"The 'booknlp_models' folder does not exist at {models_folder}. Please ensure it is placed correctly.") | |