File size: 2,247 Bytes
486eff6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""
Test interactive parsing logic matches original behavior
"""

def test_interactive_parsing():
    print("🧪 Testing Interactive Command Parsing")
    print("=" * 50)
    
    test_commands = [
        "I will always love you",
        "cats, dogs, pets",
        "\"I love you, moonpie, chocolate\"",
        "science, technology 15",
        "single_word",
    ]
    
    for user_input in test_commands:
        print(f"\n📝 Input: {user_input}")
        
        # Simulate the parsing logic from interactive mode
        parts = user_input.split()
        
        # Handle quoted strings
        if user_input.startswith('"') and '"' in user_input[1:]:
            quote_end = user_input.index('"', 1)
            quoted_content = user_input[1:quote_end]
            remaining = user_input[quote_end + 1:].strip()
            
            if ',' in quoted_content:
                inputs = [item.strip() for item in quoted_content.split(',') if item.strip()]
            else:
                inputs = [quoted_content]
            
            remaining_parts = remaining.split() if remaining else []
        else:
            # Find where parameters start
            param_keywords = ['tier', 'difficulty', 'multi']
            input_end = len(parts)
            
            for i, part in enumerate(parts):
                if part.lower() in param_keywords or part.isdigit():
                    input_end = i
                    break
            
            # Join the input parts to look for comma separation
            input_text = ' '.join(parts[:input_end])
            remaining_parts = parts[input_end:]
            
            if ',' in input_text:
                inputs = [item.strip() for item in input_text.split(',') if item.strip()]
            else:
                inputs = [input_text] if input_text.strip() else []
        
        # Check multi-theme logic
        clean_inputs = [inp.strip().lower() for inp in inputs if inp.strip()]
        auto_multi_theme = len(clean_inputs) > 2
        
        print(f"   Parsed: {clean_inputs}")
        print(f"   Length: {len(clean_inputs)} -> Auto multi-theme: {auto_multi_theme}")

if __name__ == "__main__":
    test_interactive_parsing()