def main(train_path, test_path): print("Naive Bayes Classifier:") nb.main(train_path, test_path) print("\nK Nearest Neighbor Classifier") knn.main(train_path, test_path)
print('3 -> Classify New Emails.\n4 -> Back.') choice2 = int(input('Enter your choice: ')) if choice2 == 1: # Classify Dataset dataset_name = input( 'Enter the name of dataset folder to be classified: ') knn.main(dataset_name) elif choice2 == 2: # Classify Testset dataset_name = input( 'Enter the name of dataset folder to be used as training set: ' ) testset_name = input('Enter the name of test set folder: ') knn_classify.main(dataset_name, testset_name) elif choice2 == 3: # Classify New Emails dataset_name = input( 'Enter the name of dataset folder to be used as training set: ' ) reply = input( 'Do you want get new unread emails from your email account? (y/n): ' )[0].lower() if reply == 'y': usr = input('Email: ') pwd = getpass('Password: ') e = Mail() success = e.login(usr, pwd)
print('\nkNN Classification:') print('1 -> Classify Dataset. (Splits Dataset into training and test set)') print('2 -> Classify Testset. (Test kNN accuracy using Dataset as training set)') print('3 -> Classify New Emails.\n4 -> Back.') choice2 = int(input('Enter your choice: ')) if choice2 == 1: # Classify Dataset dataset_name = input('Enter the name of dataset folder to be classified: ') knn.main(dataset_name) elif choice2 == 2: # Classify Testset dataset_name = input('Enter the name of dataset folder to be used as training set: ') testset_name = input('Enter the name of test set folder: ') knn_classify.main(dataset_name, testset_name) elif choice2 == 3: # Classify New Emails dataset_name = input('Enter the name of dataset folder to be used as training set: ') reply = input('Do you want get new unread emails from your email account? (y/n): ')[0].lower() if reply == 'y': usr = input('Email: ') pwd = getpass('Password: '******'Enter a folder name to store new emails: ') if platform.system() == 'Windows': new_emails_path = current_path + new_emails_name + "\\"