Download visualizer.html from eduhk-compling/groupK_project_BroadcastflowCN: direct link, hf CLI and curl.
- Browser
- Download file 3.88 kB
-
https://huggingface.co/datasets/eduhk-compling/groupK_project_BroadcastflowCN/resolve/main/visualizer.html
- Command line
-
hf download hf://datasets/eduhk-compling/groupK_project_BroadcastflowCN/visualizer.html
-
curl -L -o visualizer.html https://huggingface.co/datasets/eduhk-compling/groupK_project_BroadcastflowCN/resolve/main/visualizer.html
3.88 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Prosody Corpus Visualizer (2012-2026)</title> | |
| <style> | |
| body { font-family: "Microsoft YaHei", sans-serif; background: #f5f7f9; padding: 20px; } | |
| .container { max-width: 1000px; margin: auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } | |
| h1 { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; } | |
| .row { border-bottom: 1px solid #eee; padding: 15px 0; display: flex; align-items: flex-start; } | |
| .id { font-weight: bold; color: #7f8c8d; min-width: 80px; font-family: monospace; } | |
| .text { line-height: 2; font-size: 18px; color: #2c3e50; } | |
| /* Pause Tags (Boxes) */ | |
| .pause { display: inline-block; padding: 0 4px; margin: 0 2px; border-radius: 3px; font-size: 12px; font-weight: bold; vertical-align: middle; line-height: 1.4; color: white; } | |
| .p-str { background-color: #95a5a6; } /* Grey for Structural */ | |
| .p-cog { background-color: #3498db; } /* Blue for Cognitive */ | |
| .p-prg { background-color: #9b59b6; } /* Purple for Pragmatic */ | |
| /* Stress Tags (Underlines/Bold) */ | |
| .stress-box { position: relative; display: inline-block; border-bottom: 3px solid; padding-bottom: 1px; font-weight: bold; } | |
| .s-norm { border-color: #27ae60; color: #27ae60; } /* Green */ | |
| .s-emp-int { border-color: #e74c3c; color: #c0392b; } /* Red */ | |
| .s-emp-emo { border-color: #f1c40f; color: #d35400; } /* Orange */ | |
| .s-con-e { border-color: #e67e22; text-decoration: wavy underline; } | |
| .tag-label { font-size: 10px; position: absolute; top: -15px; left: 0; text-transform: uppercase; white-space: nowrap; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1>Prosody Annotation Visualizer</h1> | |
| <input type="file" id="csvFile" accept=".csv" style="margin-bottom: 20px;"> | |
| <div id="output"></div> | |
| </div> | |
| <script> | |
| document.getElementById('csvFile').onchange = function(e) { | |
| const file = e.target.files[0]; | |
| const reader = new FileReader(); | |
| reader.onload = function(event) { | |
| const text = event.target.result; | |
| processData(text); | |
| }; | |
| reader.readAsText(file); | |
| }; | |
| function processData(csv) { | |
| const lines = csv.split('\n').slice(1); | |
| const output = document.getElementById('output'); | |
| output.innerHTML = ''; | |
| lines.forEach(line => { | |
| if (!line.trim()) return; | |
| // Simple CSV split (handling quoted text) | |
| const parts = line.match(/(".*?"|[^,]+)/g); | |
| if (!parts || parts.length < 2) return; | |
| const id = parts[0].replace(/"/g, ''); | |
| let content = parts.slice(1).join(',').replace(/"/g, ''); | |
| // 1. Process Pauses [P_...] | |
| content = content.replace(/\[P_STR\]/g, '<span class="pause p-str">STR</span>'); | |
| content = content.replace(/\[P_COG\]/g, '<span class="pause p-cog">COG</span>'); | |
| content = content.replace(/\[P_PRG\]/g, '<span class="pause p-prg">PRG</span>'); | |
| // 2. Process Stress [S_...] + following word | |
| // Regex looks for [S_TAG] followed by Chinese characters or English words | |
| const stressRegex = /\[(S_[A-Z_]+)\]([\u4e00-\u9fa5]+|[a-zA-Z0-9]+)/g; | |
| content = content.replace(stressRegex, function(match, tag, word) { | |
| const className = tag.toLowerCase().replace(/_/g, '-'); | |
| const label = tag.replace('S_', '').replace('_', ' '); | |
| return `<span class="stress-box ${className}"><span class="tag-label">${label}</span>${word}</span>`; | |
| }); | |
| const row = document.createElement('div'); | |
| row.className = 'row'; | |
| row.innerHTML = `<div class="id">${id}</div><div class="text">${content}</div>`; | |
| output.appendChild(row); | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> |