Hello Dige,
I replaced the HTML with this one (yours), but it's not working!
Can you help me?
Html$ = ~"<!DOCTYPE html>\n" +
~"<html lang=fr>\n" +
~"<head><meta charset=utf-8><title>Voice To Text – Grammar Bias</title></head>\n" +
~"<body>\n" +
~"<div id=output></div>\n" +
~"<script>\n" +
~"const outputDiv = document.getElementById('output');\n" +
~"const SR = window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.msSpeechRecognition;\n" +
~"const SGL = window.SpeechGrammarList || window.webkitSpeechGrammarList;\n" +
~"const recognition = new SR();\n" +
~"//

GrammarList hinzufügen (bias auf Keywords)\n" +
~"If (SGL) {\n" +
~"// JSGF-Grammatik mit deinen Keywords\n" +
~"const grammar = '#JSGF V1.0; grammar keywords; public <keyword> = Go | Alexa | Purebasic | HeySiri | Hey Siri ;';\n" +
~"const List = new SGL();\n" +
~"List.addFromString(grammar, 1); // Gewicht 1.0 (max)\n" +
~"recognition.grammars = List;\n" +
~"}\n" +
~"// Low-Latency-Settings\n" +
~"recognition.lang = 'fr-FR';\n" +
~"recognition.interimResults = true;\n" +
~"recognition.continuous = true;\n" +
~"recognition.maxAlternatives = 1;\n" +
~"let finalText = '';\n" +
~"recognition.onresult = (event) => {\n" +
~"let interim = '';\n" +
~"For (let i = event.resultIndex; i < event.results.length; i++) {\n" +
~"const res = event.results
;\n" +
~"If (res.isFinal) finalText += res[0].transcript;\n" +
~"Else interim += res[0].transcript;\n" +
~"}\n" +
~"const text = (finalText + interim).trim();\n" +
~"outputDiv.textContent = text;\n" +
~"If (window.output) window.output(text);\n" +
~"};\n" +
~"recognition.onspeechend = () => { try { recognition.stop(); } catch(_) {} };\n" +
~"recognition.onend = () => { try { recognition.start(); } catch(_) {} };\n" +
~"document.addEventListener('DOMContentLoaded', () => {\n" +
~"try { recognition.start(); } catch(_) {}\n" +
~"});\n" +
~"</script>\n" +
~"</body>\n" +
~"</html>\n"