{"id":28193080,"url":"https://github.com/liatemplates/speech-recognition-quiz","last_synced_at":"2026-02-17T23:03:04.933Z","repository":{"id":292200583,"uuid":"980082780","full_name":"LiaTemplates/Speech-Recognition-Quiz","owner":"LiaTemplates","description":"Create quizzes that check spoken text","archived":false,"fork":false,"pushed_at":"2025-05-08T19:47:40.000Z","size":827,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-16T02:09:55.215Z","etag":null,"topics":["liascript","liascript-template","markdown","oer","quiz","speech-recognition","speech-to-text"],"latest_commit_sha":null,"homepage":"https://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/Speech-Recognition-Quiz/main/README.md","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiaTemplates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-08T14:33:06.000Z","updated_at":"2025-10-09T18:47:53.000Z","dependencies_parsed_at":"2025-10-16T01:38:44.303Z","dependency_job_id":"6306ff5b-cb5e-430d-8bbf-314768bfb1c6","html_url":"https://github.com/LiaTemplates/Speech-Recognition-Quiz","commit_stats":null,"previous_names":["liatemplates/speech-recognition-quiz"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/LiaTemplates/Speech-Recognition-Quiz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FSpeech-Recognition-Quiz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FSpeech-Recognition-Quiz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FSpeech-Recognition-Quiz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FSpeech-Recognition-Quiz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiaTemplates","download_url":"https://codeload.github.com/LiaTemplates/Speech-Recognition-Quiz/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FSpeech-Recognition-Quiz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29561783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["liascript","liascript-template","markdown","oer","quiz","speech-recognition","speech-to-text"],"created_at":"2025-05-16T12:16:28.207Z","updated_at":"2026-02-17T23:03:04.909Z","avatar_url":"https://github.com/LiaTemplates.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nauthor:    André Dietrich\nemail:     liascript@web.de\nversion:   0.0.1\nlanguage:  en\nnarrator:  US English Female\ncomment:   Template for SpeechRecognition-powered quizzes in LiaScript\nlogo:      logo.jpg\n\n@SpeechRecognition.support\n\u003cscript modify=\"false\" run-once\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  \"LIASCRIPT: \u003e 'Speech Recognition' not supported in this browser. Try Chrome, Opera, or Edge.\";\n} else {\n  \"LIASCRIPT: \u003e Your browser does support 'Speech Recognition' ...\"\n}\n\u003c/script\u003e\n@end\n\n@SpeechRecognition\n\u003cscript\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  alert('SpeechRecognition not supported. Try Chrome, Opera, or Edge.');\n} else {\n  const recognition = new SpeechRecognition();\n  recognition.lang = '@0';\n  recognition.interimResults = false;\n  recognition.continuous = false;\n\n  const solution = \"@1\".toLowerCase()\n    .replace(/(\\.|\\?|\\!|\\,|\\-|\\;)/g,\" \")\n    .replace(/[ ]+/g,\" \")\n    .trim();\n\n  recognition.onresult = ev =\u003e {\n    let t = ev.results[0][0].transcript?.toLowerCase().trim() || '';\n    if (t === solution) {\n      send.lia(\"true\");\n    } else {\n      send.lia(\"Please try again …\",[],false);\n    }\n  };\n  recognition.onerror = ev =\u003e send.lia(\"Error: \"+ev.error,[],false);\n  recognition.onend   = () =\u003e console.log('Speech recognition ended.');\n  recognition.start();\n}\n\"LIA: wait\"\n\u003c/script\u003e\n@end\n\n@SpeechRecognition.withFeedback\n\u003cscript\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  alert('SpeechRecognition not supported. Try Chrome, Opera, or Edge.');\n} else {\n  const recognition = new SpeechRecognition();\n  recognition.lang = '@0';\n  recognition.interimResults = false;\n  recognition.continuous = false;\n\n  const solution = \"@1\".toLowerCase()\n    .replace(/(\\.|\\?|\\!|\\,|\\-|\\;)/g,\" \")\n    .replace(/[ ]+/g,\" \")\n    .trim();\n\n  recognition.onresult = ev =\u003e {\n    let t = ev.results[0][0].transcript?.toLowerCase().trim() || '';\n    if (t === solution) {\n      send.lia(\"true\");\n    } else {\n      send.lia(t,[],false);\n    }\n  };\n  recognition.onerror = ev =\u003e send.lia(\"Error: \"+ev.error,[],false);\n  recognition.onend   = () =\u003e console.log('Speech recognition ended.');\n  recognition.start();\n}\n\"LIA: wait\"\n\u003c/script\u003e\n@end\n--\u003e\n\n# Speech-Recognition-Quiz Template\n\n                          --{{0}}--\nThe **SpeechRecognition** API lets you convert spoken words into text right in the browser—no server calls needed. Modern Chromium-based browsers (Chrome, Edge, Opera) support it; Firefox and Safari currently do not.\n\n__Try it on LiaScript:__\n\nhttps://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/Speech-Recognition-Quiz/main/README.md\n\n__See the project on Github:__\n\nhttps://github.com/liaTemplates/Speech-Recognition-Quiz\n\n                         --{{1}}--\nLike with other LiaScript templates, there are three ways to integrate this feature into your project, but the easiest way is to copy the import statement into the header of your LiaScript course.\n\n                           {{1}}\n1. Load the latest macros via (this might cause breaking changes)\n\n   `import: https://raw.githubusercontent.com/LiaTemplates/Speech-Recognition-Quiz/refs/heads/main/README.md`\n\n   or the current version 0.0.1 via:\n\n   `import: https://raw.githubusercontent.com/LiaTemplates/Speech-Recognition-Quiz/refs/tags/0.0.1/README.md`\n\n2. __Copy the definitions into your Project__\n\n3. Clone this repository on GitHub\n\n## 1. `@SpeechRecognition.support`\n\nThis macro runs once at load time and reports whether the API is available in your learner’s browser.\n\n`@SpeechRecognition.support`\n\n@SpeechRecognition.support\n\n## 2. Language Codes\n\nSpeechRecognition uses [BCP-47 language tags](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). Common examples:\n\n* **en-US**: American English\n* **en-GB**: British English\n* **de-DE**: German (Germany)\n* **fr-FR**: French (France)\n* **es-ES**: Spanish (Spain)\n* **zh-CN**: Mandarin Chinese (Simplified)\n* **ja-JP**: Japanese\n* **ar-SA**: Arabic (Saudi Arabia)\n\nYou can look up others at [IANA Language Subtag Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).\n\n## 3. Macro Usage\n\n### `@SpeechRecognition(lang, phrase)`\n\nThe `[[!]]` syntax is used to create generic quizzes in LiaScript.\nAs with all quizzes in LiaScript, you can add hints and a solution and more settings to it, if you want to.\nThe two parameters that you need to provide are the language code and the phrase you want the learner to say.\n\n- **lang**: BCP-47 code\n- **phrase**: expected text (punctuation is ignored)\n\n``` markdown\n[[!]]\n@SpeechRecognition(en-US,Hello world)\n```\n\n**Result:**\n\n[[!]]\n@SpeechRecognition(en-US,Hello world)\n\n    {{1}}\n\u003csection\u003e\n\nIn order to remove the default solution button, you can add the `data-solution-button=\"off\"` attribute to the quiz.\nThis will hide the solution button and only show the quiz itself.\n\n``` markdown\n\u003c!-- data-solution-button=\"off\" --\u003e\n[[!]]\n@SpeechRecognition(en-US,Hello world)\n```\n\n**Result:**\n\n\u003c!-- data-solution-button=\"off\" --\u003e\n[[!]]\n@SpeechRecognition(en-US,Hello world)\n\n\u003c/section\u003e\n\n          --{{2}}--\nFor more information on quizzes and their settings, please refer to the LiaScript documentation:\n\n{{2}} https://liascript.github.io/course/?https://raw.githubusercontent.com/liaScript/docs/master/README.md#Further-Settings\n\n### `@SpeechRecognition.withFeedback(lang, phrase)`\n\n          --{{0}}--\nThis macro works the same way as the one above, but it returns the actual transcript on mismatch.\nThis is useful for providing feedback to learners.\n\n``` markdown\n\u003c!-- data-solution-button=\"off\" --\u003e\n[[!]]\n@SpeechRecognition.withFeedback(fr-FR,Bonjour le monde)\n```\n\n**Result:**\n\n\u003c!-- data-solution-button=\"off\" --\u003e\n[[!]]\n@SpeechRecognition.withFeedback(fr-FR,Bonjour le monde)\n\n## 4. Examples in Different Languages\n\nSay \"Good morning\" in American English.\n\n[[!]]\n@SpeechRecognition(en-US,`Good morning`)\n\n---\n\nWhat about \"Good morning\" in German? \n\n[[!]]\n@SpeechRecognition(de-DE,`Guten Morgen`)\n\n---\n\nFrench (with feedback): Please say \"Je m'appelle Claude\".\n\n[[!]]\n@SpeechRecognition.withFeedback(fr-FR,`Je m'appelle Claude`)\n\n---\n\nHow are you in Spanish?\n\n[[!]]\n@SpeechRecognition(es-ES,`Cómo estás?`)\n\n---\n\nMandarin Chinese, please say \"你好世界\" (Nǐ hǎo shìjiè).\n\n\n[[!]]\n@SpeechRecognition.withFeedback(zh-CN,`你好世界`)\n\n## Implementation\n\n                        --{{0}}--\nIf you want to minimize loading effort in your LiaScript project, you can also copy this code and paste it into your main comment header, but this is the entire implementation.\n\n``` html\n@SpeechRecognition.support\n\u003cscript modify=\"false\" run-once\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  \"LIASCRIPT: \u003e 'Speech Recognition' not supported in this browser. Try Chrome, Opera, or Edge.\";\n} else {\n  \"LIASCRIPT: \u003e Your browser does support 'Speech Recognition' ...\"\n}\n\u003c/script\u003e\n@end\n\n@SpeechRecognition\n\u003cscript\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  alert('SpeechRecognition not supported. Try Chrome, Opera, or Edge.');\n} else {\n  const recognition = new SpeechRecognition();\n  recognition.lang = '@0';\n  recognition.interimResults = false;\n  recognition.continuous = false;\n\n  const solution = \"@1\".toLowerCase()\n    .replace(/(\\.|\\?|\\!|\\,|\\-|\\;)/g,\" \")\n    .replace(/[ ]+/g,\" \")\n    .trim();\n\n  recognition.onresult = ev =\u003e {\n    let t = ev.results[0][0].transcript?.toLowerCase().trim() || '';\n    if (t === solution) {\n      send.lia(\"true\");\n    } else {\n      send.lia(\"Please try again …\",[],false);\n    }\n  };\n  recognition.onerror = ev =\u003e send.lia(\"Error: \"+ev.error,[],false);\n  recognition.onend   = () =\u003e console.log('Speech recognition ended.');\n  recognition.start();\n}\n\"LIA: wait\"\n\u003c/script\u003e\n@end\n\n@SpeechRecognition.withFeedback\n\u003cscript\u003e\n// Vendor prefix\nconst SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\nif (!SpeechRecognition) {\n  alert('SpeechRecognition not supported. Try Chrome, Opera, or Edge.');\n} else {\n  const recognition = new SpeechRecognition();\n  recognition.lang = '@0';\n  recognition.interimResults = false;\n  recognition.continuous = false;\n\n  const solution = \"@1\".toLowerCase()\n    .replace(/(\\.|\\?|\\!|\\,|\\-|\\;)/g,\" \")\n    .replace(/[ ]+/g,\" \")\n    .trim();\n\n  recognition.onresult = ev =\u003e {\n    let t = ev.results[0][0].transcript?.toLowerCase().trim() || '';\n    if (t === solution) {\n      send.lia(\"true\");\n    } else {\n      send.lia(t,[],false);\n    }\n  };\n  recognition.onerror = ev =\u003e send.lia(\"Error: \"+ev.error,[],false);\n  recognition.onend   = () =\u003e console.log('Speech recognition ended.');\n  recognition.start();\n}\n\"LIA: wait\"\n\u003c/script\u003e\n@end\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Fspeech-recognition-quiz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliatemplates%2Fspeech-recognition-quiz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Fspeech-recognition-quiz/lists"}