Upload app.js
Browse files
app.js
CHANGED
|
@@ -298,15 +298,12 @@ async function transcribe() {
|
|
| 298 |
|
| 299 |
if (segmentText.trim()) {
|
| 300 |
let finalSegmentText = segmentText.trim();
|
| 301 |
-
//
|
| 302 |
if (punctuationCheckbox.checked) {
|
| 303 |
const detectedLang = detect(finalSegmentText);
|
| 304 |
-
|
| 305 |
-
if (supportedLangs.includes(detectedLang)) {
|
| 306 |
-
// Strip existing punctuation before applying punctuation model
|
| 307 |
const stripped = finalSegmentText.replace(/[.,!?]/g, ' ').replace(/\s+/g, ' ').trim();
|
| 308 |
-
finalSegmentText = await applyPunctuation(stripped,
|
| 309 |
-
// Replace unknown tokens from punctuator with spaces
|
| 310 |
finalSegmentText = finalSegmentText.replace(/<unk>/gi, ' ').replace(/\s+/g, ' ').trim();
|
| 311 |
}
|
| 312 |
}
|
|
|
|
| 298 |
|
| 299 |
if (segmentText.trim()) {
|
| 300 |
let finalSegmentText = segmentText.trim();
|
| 301 |
+
// Apply punctuation/capitalization for English only
|
| 302 |
if (punctuationCheckbox.checked) {
|
| 303 |
const detectedLang = detect(finalSegmentText);
|
| 304 |
+
if (detectedLang === 'en') {
|
|
|
|
|
|
|
| 305 |
const stripped = finalSegmentText.replace(/[.,!?]/g, ' ').replace(/\s+/g, ' ').trim();
|
| 306 |
+
finalSegmentText = await applyPunctuation(stripped, 'en');
|
|
|
|
| 307 |
finalSegmentText = finalSegmentText.replace(/<unk>/gi, ' ').replace(/\s+/g, ' ').trim();
|
| 308 |
}
|
| 309 |
}
|