v79: убран phoneticAnalysis — только Whisper + слоги
This commit is contained in:
+6
-19
@@ -54,15 +54,9 @@ async function doCompare(blob, originalText, duration) {
|
||||
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
||||
setStatus('Анализ... ' + elapsed + 'с');
|
||||
}, 150);
|
||||
let whisperResult, phon;
|
||||
let whisperResult;
|
||||
try {
|
||||
const phonTimeout = new Promise(resolve =>
|
||||
setTimeout(() => resolve({ pitchHz: 0, pitchStability: 0, voiceClarity: 0, phonScore: 0 }), 15000)
|
||||
);
|
||||
[whisperResult, phon] = await Promise.all([
|
||||
transcribe(blob),
|
||||
Promise.race([phoneticAnalysis(blob), phonTimeout])
|
||||
]);
|
||||
whisperResult = await transcribe(blob);
|
||||
} catch(e) {
|
||||
clearInterval(timerId);
|
||||
isAnalyzing = false;
|
||||
@@ -71,33 +65,26 @@ async function doCompare(blob, originalText, duration) {
|
||||
}
|
||||
clearInterval(timerId);
|
||||
|
||||
const phonEmoji = phon.phonScore >= 85 ? '🟢' : phon.phonScore >= 60 ? '🟡' : '🔴';
|
||||
let recHTML = '', diffHTML = '';
|
||||
|
||||
if (whisperResult.text) {
|
||||
const _transcribed = whisperResult.text;
|
||||
const { score, words } = compareTexts(originalText, whisperResult.text);
|
||||
const recEmoji = score >= 90 ? '🟢' : score >= 70 ? '🟡' : '🔴';
|
||||
recHTML = recEmoji + ' Распознание: <b>' + score + '%</b> | 🗣 <i>' + whisperResult.text + '</i> | ';
|
||||
recHTML = recEmoji + ' Распознание: <b>' + score + '%</b> | 🗣 <i>' + whisperResult.text + '</i>';
|
||||
diffHTML =
|
||||
'<div style="margin:6px 0;font-size:0.8em;color:#999">' +
|
||||
'📋 Текст: зелёный ≥80%, жёлтый ≥50%, красный <50%' +
|
||||
'</div>' +
|
||||
renderDiff(words);
|
||||
} else {
|
||||
recHTML = '';
|
||||
recHTML = '⚠️ Не распознано';
|
||||
diffHTML = '';
|
||||
}
|
||||
|
||||
document.getElementById('score').innerHTML =
|
||||
recHTML + phonEmoji + ' Произношение: <b>' + phon.phonScore + '%</b>';
|
||||
document.getElementById('score').innerHTML = recHTML;
|
||||
|
||||
document.getElementById('diff').innerHTML = diffHTML +
|
||||
'<div class="phonetics">' +
|
||||
'<span>🎵 Тон: ' + phon.pitchHz + ' Hz</span>' +
|
||||
'<span>📏 Стабильность: ' + phon.pitchStability + '%</span>' +
|
||||
'<span>🗣 Артикуляция: ' + phon.voiceClarity + '%</span>' +
|
||||
'</div>';
|
||||
document.getElementById('diff').innerHTML = diffHTML;
|
||||
|
||||
// Слоги — в отдельный div, не в diff (diff перезаписывается)
|
||||
_currentBlob = blob;
|
||||
|
||||
Reference in New Issue
Block a user