gsaon commited on
Commit
f6d9f43
·
verified ·
1 Parent(s): ef4e2b0

Upload app.js

Browse files
Files changed (1) hide show
  1. app.js +3 -6
app.js CHANGED
@@ -298,15 +298,12 @@ async function transcribe() {
298
 
299
  if (segmentText.trim()) {
300
  let finalSegmentText = segmentText.trim();
301
- // Auto-detect language and apply punctuation if supported
302
  if (punctuationCheckbox.checked) {
303
  const detectedLang = detect(finalSegmentText);
304
- const supportedLangs = ['en', ...window.MULTILINGUAL_PUNCT_LANGS];
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, detectedLang);
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
  }