| | |
| | """ |
| | Test that the fixed behavior matches the original version exactly |
| | """ |
| |
|
| | from thematic_word_generator import UnifiedThematicWordGenerator |
| | import logging |
| |
|
| | |
| | logging.basicConfig(level=logging.INFO, format='%(message)s') |
| |
|
| | def test_exact_original_behavior(): |
| | print("π§ͺ Testing Original Behavior Matching") |
| | print("=" * 60) |
| | |
| | |
| | generator = UnifiedThematicWordGenerator(vocab_size_limit=1000) |
| | generator.initialize() |
| | |
| | print("\nπ Test 1: Single sentence input (should NOT be split)") |
| | print("Input: 'I will always love you'") |
| | print("Expected: clean_inputs=['i will always love you'], multi_theme=False") |
| | |
| | results = generator.generate_thematic_words("I will always love you", num_words=3) |
| | print(f"β
Result: Found {len(results)} words") |
| | |
| | print("\nπ Test 2: Multiple sentence inputs (should trigger multi-theme)") |
| | print("Input: ['I will always love you', 'moonpie', 'chocolate']") |
| | print("Expected: clean_inputs=['i will always love you', 'moonpie', 'chocolate'], multi_theme=True (auto)") |
| | |
| | results = generator.generate_thematic_words( |
| | ["I will always love you", "moonpie", "chocolate"], |
| | num_words=5 |
| | ) |
| | print(f"β
Result: Found {len(results)} words") |
| | |
| | print("\nπ Test 3: Manual API call with multiple sentences") |
| | print("Input: ['science is amazing', 'technology rocks', 'innovation drives progress']") |
| | print("Expected: 3 inputs β auto multi-theme=True") |
| | |
| | results = generator.generate_thematic_words( |
| | ["science is amazing", "technology rocks", "innovation drives progress"], |
| | num_words=5 |
| | ) |
| | print(f"β
Result: Found {len(results)} words") |
| | |
| | print("\nπ Test 4: Two inputs (should NOT trigger multi-theme)") |
| | print("Input: ['cats', 'dogs']") |
| | print("Expected: 2 inputs β multi_theme=False") |
| | |
| | results = generator.generate_thematic_words(["cats", "dogs"], num_words=3) |
| | print(f"β
Result: Found {len(results)} words") |
| | |
| | print("\nβ
All behavior tests completed!") |
| |
|
| | if __name__ == "__main__": |
| | test_exact_original_behavior() |