File size: 3,064 Bytes
68e723c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
import os
import re

def replace_in_file(filepath):
    try:
        with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
            content = f.read()
        
        # Comprehensive replacements
        replacements = [
            (r'DeepPersona', 'DeepPersona'),
            (r'deeppersona', 'deeppersona'),
            (r'DeepPersona', 'DeepPersona'),
            (r'deeppersona', 'deeppersona'),
            (r'DeepPersonaFactory', 'DeepPersonaFactory'),
            (r'DeepWorld', 'DeepWorld'),
            (r'DeepSocialNetwork', 'DeepSocialNetwork'),
            (r'DeepMentalFaculty', 'DeepMentalFaculty'),
            (r'DeepMemory', 'DeepMemory'),
            (r'DeepTool', 'DeepTool'),
            (r'DeepStory', 'DeepStory'),
            (r'DeepEnricher', 'DeepEnricher'),
            (r'DeepStyler', 'DeepStyler'),
            (r'DeepValidator', 'DeepValidator'),
            (r'DeepWordProcessor', 'DeepWordProcessor'),
            (r'DeepCalendar', 'DeepCalendar'),
            (r'DeepToolUse', 'DeepToolUse'),
            (r'DeepPersonaFactory', 'DeepPersonaFactory'),
            (r'DeepPersonaValidator', 'DeepPersonaValidator'),
            (r'DeepSocialWorld', 'DeepSocialWorld'),
            # Lowercase versions for file names or variables
            (r'deep_world', 'deep_world'),
            (r'deep_social_network', 'deep_social_network'),
            (r'social_deep_world', 'social_deep_world'),
            (r'deep_persona_factory', 'deep_persona_factory'),
            (r'deep_persona_factory_base', 'deep_persona_factory_base'),
            (r'deep_persona', 'deep_persona'),
            (r'deep_styler', 'deep_styler'),
            (r'deep_enricher', 'deep_enricher'),
            (r'deep_story', 'deep_story'),
            (r'deep_tool', 'deep_tool'),
            (r'deep_calendar', 'deep_calendar'),
            (r'deep_word_processor', 'deep_word_processor'),
            (r'deep_personaa', 'deep_persona'),
            # Space or human readable
            (r'Deep Persona', 'Deep Persona'),
            (r'deep persona', 'deep persona')
        ]
        
        new_content = content
        for pattern, replacement in replacements:
            new_content = re.sub(pattern, replacement, new_content)
        
        if new_content != content:
            with open(filepath, 'w', encoding='utf-8') as f:
                f.write(new_content)
            print(f"Updated: {filepath}")
    except Exception as e:
        print(f"Error processing {filepath}: {e}")

def main():
    exclude_dirs = {'.git', '__pycache__', '.pytest_cache', 'venv'}
    # Including .mustache and .json which were missed or had leftovers
    target_files = {'.py', '.md', '.ini', '.toml', '.json', '.mustache', '.txt'}
    
    for root, dirs, files in os.walk('.'):
        dirs[:] = [d for d in dirs if d not in exclude_dirs]
        for file in files:
            ext = os.path.splitext(file)[1]
            if ext in target_files:
                replace_in_file(os.path.join(root, file))

if __name__ == "__main__":
    main()