File size: 2,156 Bytes
7d82b61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
76
77
78
79
import re

# table 
css = """

.scrollable-table {

    max-height: 300px;

    overflow-y: auto;

    border: 1px solid #ccc;

    padding: 10px;

    

}

.scrollable-table table {

    width: 100%;

    border-collapse: collapse;

    background-color: #FFFFFF;

    

}

.scrollable-table th, .scrollable-table td {

    border: 1px solid #ddd;

    padding: 8px;

    text-align: left;

    color: #000000

    

}

.scrollable-table th {

    background-color: #EAF2FF;

    color: #3366CC;

}

"""

def parse_transcript(transcript):
    # Regex to match the timestamps and the text
    pattern = re.compile(r'(\d{2}:\d{2})\s+(.+?)(?=\d{2}:\d{2}|$)', re.DOTALL)
    matches = pattern.findall(transcript)
    
    timestamps = []
    texts = []
    
    for match in matches:
        timestamps.append(match[0])
        texts.append(match[1].strip())
    
    return timestamps, texts

def create_transcript_table(timestamps, transcript_text):
    table_html = '<div class="scrollable-table">\n'
    table_html += '<table>\n'
    table_html += '  <thead>\n'
    table_html += '    <tr>\n'
    table_html += '      <th>Timestamp</th>\n'
    table_html += '      <th>Transcript</th>\n'
    table_html += '    </tr>\n'
    table_html += '  </thead>\n'
    table_html += '  <tbody>\n'
    for ts, text in zip(timestamps, transcript_text):
        table_html += '    <tr>\n'
        table_html += f'      <td>{ts}</td>\n'
        table_html += f'      <td>{text}</td>\n'
        table_html += '    </tr>\n'
    table_html += '  </tbody>\n'
    table_html += '</table>\n'
    return table_html

def filter_transcript():
    timestamps = [
        "15.0 - 17.0",
        "38.08 - 39.50"
    ]
    transcript_text = [
        "Sad (prompt; 1st)",
        "Because he fell (no prompt; 2nd)"
    ]
    return timestamps, transcript_text

# Guidance Generation Function
def generate_guidance():
    guidance_text = """ Engagement: Student may display behaviors such as rocking when showing engagement.

    Impact factors: Weather (e.g., raining) can impact student’s performance."""
    return guidance_text