-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (44 loc) · 1.54 KB
/
Copy pathmain.py
File metadata and controls
55 lines (44 loc) · 1.54 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
"""
Main Interface for Running Sentiment Analysis Models
Supports dataset selection and model selection
Author: Muhammed Fatih Kalkan
"""
import os
def run_program():
# Dataset Selection
print("\n===============================")
print(" Sentiment Analysis Project")
print("===============================")
print("\nAvailable datasets:")
print("1. IMDb Reviews")
print("2. Yelp Reviews")
print("3. Twitter Sentiment140")
dataset_choice = input("\nEnter the dataset number (1-3): ").strip()
if dataset_choice not in ["1", "2", "3"]:
print("Invalid choice. Defaulting to IMDb dataset.")
dataset_choice = "1"
# Model Selection
print("\nAvailable models:")
print("1. Naive Bayes (TF-IDF)")
print("2. SVM (TF-IDF)")
print("3. Word2Vec + LSTM")
print("4. FastText + LSTM")
print("5. BERT (Transformers)")
model_choice = input("\nEnter the model number (1-5): ").strip()
# Define model command mapping
model_commands = {
"1": f"python models/naive_bayes.py",
"2": f"python models/svm_model.py",
"3": f"python models/word2vec_lstm.py",
"4": f"python models/fasttext_lstm.py",
"5": f"python models/bert_model.py",
}
if model_choice not in model_commands:
print("Invalid model choice.")
return
# Set environment variable to pass dataset choice
os.environ["DATASET_CHOICE"] = dataset_choice
# Run selected model
os.system(model_commands[model_choice])
if __name__ == "__main__":
run_program()