| """ | |
| Simple test script for the text classification model | |
| """ | |
| from text_classifier import TextClassifier | |
| def test_model(): | |
| classifier = TextClassifier() | |
| # Test cases | |
| test_cases = [ | |
| ("I love this product!", "positive"), | |
| ("This is terrible.", "negative"), | |
| ("It's okay, nothing special.", None), # Could be positive or neutral | |
| ] | |
| print("Testing Text Classification Model:") | |
| print("-" * 40) | |
| for text, expected_label in test_cases: | |
| result = classifier.predict(text) | |
| print(f"Input: {text}") | |
| print(f"Predicted: {result['label']} (confidence: {result['confidence']})") | |
| if expected_label: | |
| print(f"Expected: {expected_label}") | |
| print() | |
| print("Test completed successfully!") | |
| if __name__ == "__main__": | |
| test_model() |