File size: 2,351 Bytes
b7a7046
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import re
import os

def slugify(text):
    text = re.sub(r'[^a-zA-Z0-9]', '_', text.lower()).strip('_')
    return re.sub(r'_+', '_', text)

def generate_readme(input_md="e.md", output_md="README.md"):
    with open(input_md, 'r', encoding='utf-8') as f:
        lines = f.readlines()

    readme_content = [
        "---",
        "title: Reinforcement Learning Graphical Representations",
        "date: 2026-04-08",
        "category: Reinforcement Learning",
        "description: A comprehensive gallery of 130 standard RL components and their graphical presentations.",
        "---\n\n",
        "# Reinforcement Learning Graphical Representations\n\n",
        "This repository contains a full set of 130 visualizations representing foundational concepts, algorithms, and advanced topics in Reinforcement Learning.\n\n"
    ]

    # Process table
    # Standard table headers: Category | Component | Description | Presentation | Contexts
    # We want: Category | Component | Illustration | Description
    
    header = "| Category | Component | Illustration | Details | Context |\n"
    separator = "|----------|-----------|--------------|---------|---------|\n"
    
    readme_content.append(header)
    readme_content.append(separator)

    for line in lines:
        if line.startswith("|") and "Category" not in line and "---" not in line:
            parts = [p.strip() for p in line.split("|") if p.strip()]
            if len(parts) >= 2:
                category = parts[0]
                component = parts[1].replace("**", "")
                description = parts[2]
                # presentation = parts[3] # We replace this or merge it
                context = parts[4] if len(parts) > 4 else ""
                
                img_name = slugify(component) + ".png"
                img_link = f"![Illustration](graphs/{img_name})"
                
                # Create row
                # We combine Description and Presentation for "Details"
                details = description
                new_row = f"| {category} | **{component}** | {img_link} | {details} | {context} |\n"
                readme_content.append(new_row)

    with open(output_md, 'w', encoding='utf-8') as f:
        f.writelines(readme_content)

    print(f"[SUCCESS] Generated {output_md}")

if __name__ == "__main__":
    generate_readme()