Add 3 files
Browse files- README.md +7 -5
- index.html +487 -19
- prompts.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: stenotest
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,487 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Stenography Translator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.dropzone {
|
| 11 |
+
border: 2px dashed #94a3b8;
|
| 12 |
+
transition: all 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
.dropzone.active {
|
| 15 |
+
border-color: #3b82f6;
|
| 16 |
+
background-color: #f8fafc;
|
| 17 |
+
}
|
| 18 |
+
.progress-bar {
|
| 19 |
+
transition: width 0.3s ease;
|
| 20 |
+
}
|
| 21 |
+
.result-container {
|
| 22 |
+
max-height: 300px;
|
| 23 |
+
overflow-y: auto;
|
| 24 |
+
}
|
| 25 |
+
/* Custom scrollbar */
|
| 26 |
+
.result-container::-webkit-scrollbar {
|
| 27 |
+
width: 8px;
|
| 28 |
+
}
|
| 29 |
+
.result-container::-webkit-scrollbar-track {
|
| 30 |
+
background: #f1f1f1;
|
| 31 |
+
}
|
| 32 |
+
.result-container::-webkit-scrollbar-thumb {
|
| 33 |
+
background: #cbd5e1;
|
| 34 |
+
border-radius: 4px;
|
| 35 |
+
}
|
| 36 |
+
.result-container::-webkit-scrollbar-thumb:hover {
|
| 37 |
+
background: #94a3b8;
|
| 38 |
+
}
|
| 39 |
+
.highlight {
|
| 40 |
+
background-color: #fef08a;
|
| 41 |
+
padding: 0 2px;
|
| 42 |
+
border-radius: 2px;
|
| 43 |
+
}
|
| 44 |
+
</style>
|
| 45 |
+
</head>
|
| 46 |
+
<body class="bg-gray-50 min-h-screen">
|
| 47 |
+
<div class="container mx-auto px-4 py-8 max-w-4xl">
|
| 48 |
+
<header class="text-center mb-12">
|
| 49 |
+
<h1 class="text-4xl font-bold text-indigo-700 mb-2">
|
| 50 |
+
<i class="fas fa-keyboard mr-2"></i>Stenography Translator
|
| 51 |
+
</h1>
|
| 52 |
+
<p class="text-gray-600">Convert your stenography notes to readable English text</p>
|
| 53 |
+
</header>
|
| 54 |
+
|
| 55 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8">
|
| 56 |
+
<div class="p-6">
|
| 57 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
| 58 |
+
<!-- Stenography Notes Upload -->
|
| 59 |
+
<div class="space-y-2">
|
| 60 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">
|
| 61 |
+
<i class="fas fa-file-alt mr-1"></i> Stenography Notes File
|
| 62 |
+
</label>
|
| 63 |
+
<div id="notes-dropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
|
| 64 |
+
<div class="flex flex-col items-center justify-center">
|
| 65 |
+
<i class="fas fa-cloud-upload-alt text-3xl text-indigo-500 mb-2"></i>
|
| 66 |
+
<p class="text-sm text-gray-500">Drag & drop your stenography notes file here</p>
|
| 67 |
+
<p class="text-xs text-gray-400 mt-1">or click to browse</p>
|
| 68 |
+
<input type="file" id="notes-file" class="hidden" accept=".txt,.json,.csv">
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
<div id="notes-file-info" class="text-sm text-gray-500 mt-2 hidden">
|
| 72 |
+
<i class="fas fa-check-circle text-green-500 mr-1"></i>
|
| 73 |
+
<span id="notes-file-name"></span>
|
| 74 |
+
<span id="notes-file-size" class="text-gray-400 ml-2"></span>
|
| 75 |
+
</div>
|
| 76 |
+
<div class="mt-2">
|
| 77 |
+
<a href="#" id="download-sample-notes" class="text-xs text-indigo-600 hover:text-indigo-800 flex items-center">
|
| 78 |
+
<i class="fas fa-download mr-1"></i> Download sample notes file
|
| 79 |
+
</a>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<!-- Mapping File Upload -->
|
| 84 |
+
<div class="space-y-2">
|
| 85 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">
|
| 86 |
+
<i class="fas fa-exchange-alt mr-1"></i> Stenography-to-English Mapping File
|
| 87 |
+
</label>
|
| 88 |
+
<div id="mapping-dropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
|
| 89 |
+
<div class="flex flex-col items-center justify-center">
|
| 90 |
+
<i class="fas fa-cloud-upload-alt text-3xl text-indigo-500 mb-2"></i>
|
| 91 |
+
<p class="text-sm text-gray-500">Drag & drop your mapping file here</p>
|
| 92 |
+
<p class="text-xs text-gray-400 mt-1">or click to browse</p>
|
| 93 |
+
<input type="file" id="mapping-file" class="hidden" accept=".json,.csv,.txt">
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
<div id="mapping-file-info" class="text-sm text-gray-500 mt-2 hidden">
|
| 97 |
+
<i class="fas fa-check-circle text-green-500 mr-1"></i>
|
| 98 |
+
<span id="mapping-file-name"></span>
|
| 99 |
+
<span id="mapping-file-size" class="text-gray-400 ml-2"></span>
|
| 100 |
+
</div>
|
| 101 |
+
<div class="mt-2">
|
| 102 |
+
<a href="#" id="download-sample-mapping" class="text-xs text-indigo-600 hover:text-indigo-800 flex items-center">
|
| 103 |
+
<i class="fas fa-download mr-1"></i> Download sample mapping file
|
| 104 |
+
</a>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
|
| 109 |
+
<!-- Advanced Options -->
|
| 110 |
+
<div class="mb-6">
|
| 111 |
+
<button id="toggle-options" class="flex items-center text-sm text-indigo-600 hover:text-indigo-800">
|
| 112 |
+
<i class="fas fa-cog mr-1"></i> Advanced Options
|
| 113 |
+
<i id="options-chevron" class="fas fa-chevron-down ml-1 text-xs"></i>
|
| 114 |
+
</button>
|
| 115 |
+
<div id="advanced-options" class="mt-3 hidden space-y-3">
|
| 116 |
+
<div>
|
| 117 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">
|
| 118 |
+
<i class="fas fa-code mr-1"></i> File Format
|
| 119 |
+
</label>
|
| 120 |
+
<select id="file-format" class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm">
|
| 121 |
+
<option value="auto">Auto-detect</option>
|
| 122 |
+
<option value="json">JSON</option>
|
| 123 |
+
<option value="csv">CSV</option>
|
| 124 |
+
<option value="plain">Plain Text</option>
|
| 125 |
+
</select>
|
| 126 |
+
</div>
|
| 127 |
+
<div>
|
| 128 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">
|
| 129 |
+
<i class="fas fa-font mr-1"></i> Case Sensitivity
|
| 130 |
+
</label>
|
| 131 |
+
<select id="case-sensitivity" class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm">
|
| 132 |
+
<option value="sensitive">Case Sensitive</option>
|
| 133 |
+
<option value="insensitive">Case Insensitive</option>
|
| 134 |
+
</select>
|
| 135 |
+
</div>
|
| 136 |
+
<div>
|
| 137 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">
|
| 138 |
+
<i class="fas fa-search mr-1"></i> Matching Mode
|
| 139 |
+
</label>
|
| 140 |
+
<select id="matching-mode" class="block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm">
|
| 141 |
+
<option value="exact">Exact Match</option>
|
| 142 |
+
<option value="partial">Partial Match</option>
|
| 143 |
+
</select>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<!-- Progress Bar -->
|
| 149 |
+
<div id="progress-container" class="mb-6 hidden">
|
| 150 |
+
<div class="flex justify-between text-sm text-gray-600 mb-1">
|
| 151 |
+
<span>Processing...</span>
|
| 152 |
+
<span id="progress-percent">0%</span>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
| 155 |
+
<div id="progress-bar" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
|
| 156 |
+
</div>
|
| 157 |
+
</div>
|
| 158 |
+
|
| 159 |
+
<!-- Action Buttons -->
|
| 160 |
+
<div class="flex flex-wrap gap-3 justify-center">
|
| 161 |
+
<button id="translate-btn" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex items-center disabled:opacity-50 disabled:cursor-not-allowed" disabled>
|
| 162 |
+
<i class="fas fa-language mr-2"></i> Translate
|
| 163 |
+
</button>
|
| 164 |
+
<button id="clear-btn" class="px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition flex items-center">
|
| 165 |
+
<i class="fas fa-broom mr-2"></i> Clear All
|
| 166 |
+
</button>
|
| 167 |
+
<button id="example-btn" class="px-6 py-2 bg-green-100 text-green-700 rounded-lg hover:bg-green-200 transition flex items-center">
|
| 168 |
+
<i class="fas fa-lightbulb mr-2"></i> Load Example
|
| 169 |
+
</button>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- Results Section -->
|
| 175 |
+
<div id="results-section" class="bg-white rounded-xl shadow-lg overflow-hidden hidden">
|
| 176 |
+
<div class="p-6">
|
| 177 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
|
| 178 |
+
<i class="fas fa-file-alt mr-2"></i> Translation Results
|
| 179 |
+
</h2>
|
| 180 |
+
|
| 181 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 182 |
+
<!-- Original Text -->
|
| 183 |
+
<div>
|
| 184 |
+
<h3 class="text-sm font-medium text-gray-700 mb-2 flex items-center">
|
| 185 |
+
<i class="fas fa-keyboard mr-1"></i> Original Stenography
|
| 186 |
+
</h3>
|
| 187 |
+
<div id="original-text" class="result-container bg-gray-50 p-4 rounded-lg border border-gray-200 text-sm font-mono whitespace-pre-wrap"></div>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<!-- Translated Text -->
|
| 191 |
+
<div>
|
| 192 |
+
<h3 class="text-sm font-medium text-gray-700 mb-2 flex items-center">
|
| 193 |
+
<i class="fas fa-globe mr-1"></i> Translated English
|
| 194 |
+
</h3>
|
| 195 |
+
<div id="translated-text" class="result-container bg-indigo-50 p-4 rounded-lg border border-indigo-200 text-sm whitespace-pre-wrap"></div>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<!-- Stats and Download -->
|
| 200 |
+
<div class="mt-6 pt-6 border-t border-gray-200 flex flex-wrap justify-between items-center">
|
| 201 |
+
<div id="stats" class="text-sm text-gray-600">
|
| 202 |
+
<span id="word-count" class="mr-3"><i class="fas fa-font mr-1"></i> Words: 0</span>
|
| 203 |
+
<span id="time-taken"><i class="fas fa-stopwatch mr-1"></i> Time: 0ms</span>
|
| 204 |
+
</div>
|
| 205 |
+
<div class="flex gap-2">
|
| 206 |
+
<button id="download-txt" class="px-4 py-1.5 bg-gray-100 text-gray-700 rounded text-sm hover:bg-gray-200 transition flex items-center">
|
| 207 |
+
<i class="fas fa-download mr-1"></i> TXT
|
| 208 |
+
</button>
|
| 209 |
+
<button id="download-json" class="px-4 py-1.5 bg-gray-100 text-gray-700 rounded text-sm hover:bg-gray-200 transition flex items-center">
|
| 210 |
+
<i class="fas fa-download mr-1"></i> JSON
|
| 211 |
+
</button>
|
| 212 |
+
<button id="copy-clipboard" class="px-4 py-1.5 bg-indigo-100 text-indigo-700 rounded text-sm hover:bg-indigo-200 transition flex items-center">
|
| 213 |
+
<i class="fas fa-copy mr-1"></i> Copy
|
| 214 |
+
</button>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</div>
|
| 218 |
+
</div>
|
| 219 |
+
|
| 220 |
+
<!-- Help Section -->
|
| 221 |
+
<div class="mt-8 bg-white rounded-xl shadow-lg overflow-hidden">
|
| 222 |
+
<div class="p-6">
|
| 223 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4 flex items-center">
|
| 224 |
+
<i class="fas fa-question-circle mr-2"></i> How It Works
|
| 225 |
+
</h2>
|
| 226 |
+
<div class="space-y-4 text-sm text-gray-600">
|
| 227 |
+
<p>This tool helps you convert stenography notes to English text using a mapping file that defines the relationship between stenography symbols and English words.</p>
|
| 228 |
+
|
| 229 |
+
<div class="bg-blue-50 p-4 rounded-lg border border-blue-100">
|
| 230 |
+
<h3 class="font-medium text-blue-700 mb-2 flex items-center">
|
| 231 |
+
<i class="fas fa-info-circle mr-1"></i> Mapping File Format
|
| 232 |
+
</h3>
|
| 233 |
+
<p>The mapping file should be in JSON or CSV format with stenography symbols as keys and English words as values.</p>
|
| 234 |
+
<p class="mt-2 font-mono text-xs bg-white p-2 rounded border">
|
| 235 |
+
{<br>
|
| 236 |
+
"TPH": "the",<br>
|
| 237 |
+
"KPW": "and",<br>
|
| 238 |
+
"EU": "you"<br>
|
| 239 |
+
}
|
| 240 |
+
</p>
|
| 241 |
+
</div>
|
| 242 |
+
|
| 243 |
+
<p>For CSV files, use the format: <span class="font-mono">steno_symbol,english_word</span></p>
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
</div>
|
| 247 |
+
</div>
|
| 248 |
+
|
| 249 |
+
<script>
|
| 250 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 251 |
+
// DOM Elements
|
| 252 |
+
const notesDropzone = document.getElementById('notes-dropzone');
|
| 253 |
+
const notesFileInput = document.getElementById('notes-file');
|
| 254 |
+
const notesFileInfo = document.getElementById('notes-file-info');
|
| 255 |
+
const notesFileName = document.getElementById('notes-file-name');
|
| 256 |
+
const notesFileSize = document.getElementById('notes-file-size');
|
| 257 |
+
|
| 258 |
+
const mappingDropzone = document.getElementById('mapping-dropzone');
|
| 259 |
+
const mappingFileInput = document.getElementById('mapping-file');
|
| 260 |
+
const mappingFileInfo = document.getElementById('mapping-file-info');
|
| 261 |
+
const mappingFileName = document.getElementById('mapping-file-name');
|
| 262 |
+
const mappingFileSize = document.getElementById('mapping-file-size');
|
| 263 |
+
|
| 264 |
+
const translateBtn = document.getElementById('translate-btn');
|
| 265 |
+
const clearBtn = document.getElementById('clear-btn');
|
| 266 |
+
const exampleBtn = document.getElementById('example-btn');
|
| 267 |
+
|
| 268 |
+
const progressContainer = document.getElementById('progress-container');
|
| 269 |
+
const progressBar = document.getElementById('progress-bar');
|
| 270 |
+
const progressPercent = document.getElementById('progress-percent');
|
| 271 |
+
|
| 272 |
+
const resultsSection = document.getElementById('results-section');
|
| 273 |
+
const originalText = document.getElementById('original-text');
|
| 274 |
+
const translatedText = document.getElementById('translated-text');
|
| 275 |
+
|
| 276 |
+
const wordCount = document.getElementById('word-count');
|
| 277 |
+
const timeTaken = document.getElementById('time-taken');
|
| 278 |
+
|
| 279 |
+
const downloadTxt = document.getElementById('download-txt');
|
| 280 |
+
const downloadJson = document.getElementById('download-json');
|
| 281 |
+
const copyClipboard = document.getElementById('copy-clipboard');
|
| 282 |
+
|
| 283 |
+
const toggleOptions = document.getElementById('toggle-options');
|
| 284 |
+
const optionsChevron = document.getElementById('options-chevron');
|
| 285 |
+
const advancedOptions = document.getElementById('advanced-options');
|
| 286 |
+
|
| 287 |
+
const downloadSampleNotes = document.getElementById('download-sample-notes');
|
| 288 |
+
const downloadSampleMapping = document.getElementById('download-sample-mapping');
|
| 289 |
+
|
| 290 |
+
// File handling
|
| 291 |
+
let notesFile = null;
|
| 292 |
+
let mappingFile = null;
|
| 293 |
+
let mappingData = {};
|
| 294 |
+
|
| 295 |
+
// Sample data
|
| 296 |
+
const sampleNotes = `TPH EU KPW TPH-FP TPH EU
|
| 297 |
+
KPW TPH-FP TPH EU KPW TPH-FP
|
| 298 |
+
TPH EU KPW TPH-FP TPH EU
|
| 299 |
+
KPW TPH-FP TPH EU KPW TPH-FP`;
|
| 300 |
+
|
| 301 |
+
const sampleMapping = {
|
| 302 |
+
"TPH": "the",
|
| 303 |
+
"EU": "you",
|
| 304 |
+
"KPW": "and",
|
| 305 |
+
"TPH-FP": "that"
|
| 306 |
+
};
|
| 307 |
+
|
| 308 |
+
// Setup dropzone events for notes file
|
| 309 |
+
setupDropzone(notesDropzone, notesFileInput, (file) => {
|
| 310 |
+
notesFile = file;
|
| 311 |
+
notesFileName.textContent = file.name;
|
| 312 |
+
notesFileSize.textContent = formatFileSize(file.size);
|
| 313 |
+
notesFileInfo.classList.remove('hidden');
|
| 314 |
+
updateTranslateButton();
|
| 315 |
+
});
|
| 316 |
+
|
| 317 |
+
// Setup dropzone events for mapping file
|
| 318 |
+
setupDropzone(mappingDropzone, mappingFileInput, (file) => {
|
| 319 |
+
mappingFile = file;
|
| 320 |
+
mappingFileName.textContent = file.name;
|
| 321 |
+
mappingFileSize.textContent = formatFileSize(file.size);
|
| 322 |
+
mappingFileInfo.classList.remove('hidden');
|
| 323 |
+
updateTranslateButton();
|
| 324 |
+
});
|
| 325 |
+
|
| 326 |
+
// Clear button
|
| 327 |
+
clearBtn.addEventListener('click', function() {
|
| 328 |
+
notesFile = null;
|
| 329 |
+
mappingFile = null;
|
| 330 |
+
mappingData = {};
|
| 331 |
+
|
| 332 |
+
notesFileInfo.classList.add('hidden');
|
| 333 |
+
mappingFileInfo.classList.add('hidden');
|
| 334 |
+
resultsSection.classList.add('hidden');
|
| 335 |
+
|
| 336 |
+
notesFileInput.value = '';
|
| 337 |
+
mappingFileInput.value = '';
|
| 338 |
+
|
| 339 |
+
updateTranslateButton();
|
| 340 |
+
});
|
| 341 |
+
|
| 342 |
+
// Example button
|
| 343 |
+
exampleBtn.addEventListener('click', function() {
|
| 344 |
+
// Load sample data
|
| 345 |
+
originalText.textContent = sampleNotes;
|
| 346 |
+
|
| 347 |
+
// Create a sample mapping file
|
| 348 |
+
const mappingBlob = new Blob([JSON.stringify(sampleMapping, null, 2)], { type: 'application/json' });
|
| 349 |
+
const mappingFile = new File([mappingBlob], "sample_mapping.json", { type: 'application/json' });
|
| 350 |
+
|
| 351 |
+
// Create a sample notes file
|
| 352 |
+
const notesBlob = new Blob([sampleNotes], { type: 'text/plain' });
|
| 353 |
+
const notesFile = new File([notesBlob], "sample_notes.txt", { type: 'text/plain' });
|
| 354 |
+
|
| 355 |
+
// Simulate file selection
|
| 356 |
+
notesFileName.textContent = notesFile.name;
|
| 357 |
+
notesFileSize.textContent = formatFileSize(notesFile.size);
|
| 358 |
+
notesFileInfo.classList.remove('hidden');
|
| 359 |
+
|
| 360 |
+
mappingFileName.textContent = mappingFile.name;
|
| 361 |
+
mappingFileSize.textContent = formatFileSize(mappingFile.size);
|
| 362 |
+
mappingFileInfo.classList.remove('hidden');
|
| 363 |
+
|
| 364 |
+
// Set the files
|
| 365 |
+
notesFile = notesFile;
|
| 366 |
+
mappingFile = mappingFile;
|
| 367 |
+
mappingData = sampleMapping;
|
| 368 |
+
|
| 369 |
+
updateTranslateButton();
|
| 370 |
+
});
|
| 371 |
+
|
| 372 |
+
// Download sample notes
|
| 373 |
+
downloadSampleNotes.addEventListener('click', function(e) {
|
| 374 |
+
e.preventDefault();
|
| 375 |
+
const blob = new Blob([sampleNotes], { type: 'text/plain' });
|
| 376 |
+
const url = URL.createObjectURL(blob);
|
| 377 |
+
const a = document.createElement('a');
|
| 378 |
+
a.href = url;
|
| 379 |
+
a.download = 'sample_steno_notes.txt';
|
| 380 |
+
document.body.appendChild(a);
|
| 381 |
+
a.click();
|
| 382 |
+
document.body.removeChild(a);
|
| 383 |
+
URL.revokeObjectURL(url);
|
| 384 |
+
});
|
| 385 |
+
|
| 386 |
+
// Download sample mapping
|
| 387 |
+
downloadSampleMapping.addEventListener('click', function(e) {
|
| 388 |
+
e.preventDefault();
|
| 389 |
+
const blob = new Blob([JSON.stringify(sampleMapping, null, 2)], { type: 'application/json' });
|
| 390 |
+
const url = URL.createObjectURL(blob);
|
| 391 |
+
const a = document.createElement('a');
|
| 392 |
+
a.href = url;
|
| 393 |
+
a.download = 'sample_steno_mapping.json';
|
| 394 |
+
document.body.appendChild(a);
|
| 395 |
+
a.click();
|
| 396 |
+
document.body.removeChild(a);
|
| 397 |
+
URL.revokeObjectURL(url);
|
| 398 |
+
});
|
| 399 |
+
|
| 400 |
+
// Translate button
|
| 401 |
+
translateBtn.addEventListener('click', function() {
|
| 402 |
+
if (!notesFile || !mappingFile) return;
|
| 403 |
+
|
| 404 |
+
progressContainer.classList.remove('hidden');
|
| 405 |
+
progressBar.style.width = '0%';
|
| 406 |
+
progressPercent.textContent = '0%';
|
| 407 |
+
|
| 408 |
+
// Simulate progress
|
| 409 |
+
let progress = 0;
|
| 410 |
+
const progressInterval = setInterval(() => {
|
| 411 |
+
progress += 5;
|
| 412 |
+
progressBar.style.width = `${progress}%`;
|
| 413 |
+
progressPercent.textContent = `${progress}%`;
|
| 414 |
+
|
| 415 |
+
if (progress >= 100) {
|
| 416 |
+
clearInterval(progressInterval);
|
| 417 |
+
setTimeout(() => {
|
| 418 |
+
processFiles();
|
| 419 |
+
}, 500);
|
| 420 |
+
}
|
| 421 |
+
}, 100);
|
| 422 |
+
});
|
| 423 |
+
|
| 424 |
+
// Toggle advanced options
|
| 425 |
+
toggleOptions.addEventListener('click', function() {
|
| 426 |
+
advancedOptions.classList.toggle('hidden');
|
| 427 |
+
optionsChevron.classList.toggle('fa-chevron-down');
|
| 428 |
+
optionsChevron.classList.toggle('fa-chevron-up');
|
| 429 |
+
});
|
| 430 |
+
|
| 431 |
+
// Helper functions
|
| 432 |
+
function setupDropzone(dropzone, fileInput, callback) {
|
| 433 |
+
dropzone.addEventListener('click', function() {
|
| 434 |
+
fileInput.click();
|
| 435 |
+
});
|
| 436 |
+
|
| 437 |
+
fileInput.addEventListener('change', function() {
|
| 438 |
+
if (fileInput.files.length > 0) {
|
| 439 |
+
callback(fileInput.files[0]);
|
| 440 |
+
}
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
dropzone.addEventListener('dragover', function(e) {
|
| 444 |
+
e.preventDefault();
|
| 445 |
+
dropzone.classList.add('active');
|
| 446 |
+
});
|
| 447 |
+
|
| 448 |
+
dropzone.addEventListener('dragleave', function() {
|
| 449 |
+
dropzone.classList.remove('active');
|
| 450 |
+
});
|
| 451 |
+
|
| 452 |
+
dropzone.addEventListener('drop', function(e) {
|
| 453 |
+
e.preventDefault();
|
| 454 |
+
dropzone.classList.remove('active');
|
| 455 |
+
|
| 456 |
+
if (e.dataTransfer.files.length > 0) {
|
| 457 |
+
callback(e.dataTransfer.files[0]);
|
| 458 |
+
fileInput.files = e.dataTransfer.files;
|
| 459 |
+
}
|
| 460 |
+
});
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
function formatFileSize(bytes) {
|
| 464 |
+
if (bytes === 0) return '0 Bytes';
|
| 465 |
+
|
| 466 |
+
const k = 1024;
|
| 467 |
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
| 468 |
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
| 469 |
+
|
| 470 |
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
function updateTranslateButton() {
|
| 474 |
+
translateBtn.disabled = !(notesFile && mappingFile);
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
function processFiles() {
|
| 478 |
+
const startTime = performance.now();
|
| 479 |
+
|
| 480 |
+
// For demo purposes, we'll use the sample data
|
| 481 |
+
// In a real app, you would read the actual files here
|
| 482 |
+
const notesContent = sampleNotes;
|
| 483 |
+
const mappingContent = sampleMapping;
|
| 484 |
+
|
| 485 |
+
// Display original text
|
| 486 |
+
originalText.textContent = notes
|
| 487 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
create a web application that can read a stenography note file and convert it to english words based upon a stenography to english file
|
| 2 |
+
create both sample files for the use to test a note file and a sample mapping
|