{"id":415,"date":"2025-12-03T07:11:56","date_gmt":"2025-12-03T07:11:56","guid":{"rendered":"https:\/\/i-cte.org\/robot\/?p=415"},"modified":"2025-12-03T07:11:56","modified_gmt":"2025-12-03T07:11:56","slug":"hopes-and-intentions-listening","status":"publish","type":"post","link":"https:\/\/i-cte.org\/robot\/hopes-and-intentions-listening\/","title":{"rendered":"Hopes and Intentions &#8211; Listening"},"content":{"rendered":"\n<p>This Robot is used for practicing English at level A2. In order to interact with this Robot smoothly, please use a laptop, desktop, or iPad. Do not use Smartphones, though they are sometimes fine. It depends on the updated browsers and Internet connection.<\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Listening \u2013 Lucy\u2019s Plans After Graduation<\/title>\n    <style>\n        * { box-sizing: border-box; }\n\n        body {\n            font-family: Arial, sans-serif;\n            background-color: #f4f6f8;\n            margin: 0;\n            padding: 0;\n            display: flex;\n            flex-direction: column;\n            min-height: 100vh;\n        }\n\n        .menu {\n            width: 100%;\n            background-color: #28a745;\n            padding: 10px;\n            text-align: center;\n            box-shadow: 0 2px 5px rgba(0,0,0,0.1);\n            margin-bottom: 10px;\n            overflow-x: auto;\n            white-space: nowrap;\n        }\n        .menu a {\n            color: #fff;\n            text-decoration: none;\n            margin: 0 10px;\n            font-weight: bold;\n            font-size: 14px;\n            display: inline-block;\n        }\n        .menu a:hover,\n        .menu a:focus {\n            text-decoration: underline;\n            outline: 2px dashed #fff;\n            outline-offset: 4px;\n        }\n\n        .container {\n            display: flex;\n            flex-direction: column;\n            align-items: center;\n            padding: 10px;\n            flex: 1 0 auto;\n            width: 100%;\n        }\n\n        .image-chat-wrapper {\n            display: flex;\n            flex-direction: column;\n            width: 100%;\n            max-width: 900px;\n            flex: 1;\n        }\n\n        .image-container {\n            flex: 1;\n            text-align: center;\n            margin-bottom: 15px;\n        }\n        .image-container img {\n            width: 100%;\n            height: auto;\n            max-height: 260px;\n            object-fit: cover;\n            border-radius: 15px;\n            box-shadow: 0 0 8px rgba(0,0,0,0.1);\n        }\n        .sentence-text {\n            margin: 10px 0;\n            font-weight: bold;\n            color: #333;\n            font-size: 16px;\n        }\n        .word-box {\n            margin-top: 10px;\n            padding: 10px;\n            background-color: #fff;\n            border: 2px solid #28a745;\n            border-radius: 8px;\n            box-shadow: 0 0 8px rgba(0,0,0,0.1);\n            font-size: 15px;\n            font-weight: bold;\n            color: #28a745;\n            text-align: left;\n            max-height: 220px;\n            overflow-y: auto;\n        }\n\n        .audio-player { margin-top: 10px; }\n        .audio-player audio { width: 100%; }\n\n        .script-button {\n            margin-top: 8px;\n            background-color: #17a2b8;\n            color: #fff;\n            border: none;\n            border-radius: 5px;\n            padding: 8px 12px;\n            font-size: 14px;\n            font-weight: bold;\n            cursor: pointer;\n        }\n        .script-button:hover,\n        .script-button:focus {\n            background-color: #138496;\n            outline: none;\n        }\n\n        .chat-container {\n            background-color: #28a745;\n            border-radius: 15px;\n            box-shadow: 0 0 8px rgba(0,0,0,0.1);\n            border: 3px solid #007bff;\n            overflow: hidden;\n            display: flex;\n            flex-direction: column;\n            height: auto;\n            max-height: 620px;\n            flex: 1;\n        }\n        .chat-header {\n            background-color: #1e7e34;\n            color: #fff;\n            padding: 12px;\n            text-align: center;\n            border-bottom: 1px solid #155724;\n            position: relative;\n        }\n        .chat-header h2 {\n            margin: 0;\n            font-size: 18px;\n        }\n        .chat-header .loader {\n            position: absolute;\n            right: 20px;\n            top: 50%;\n            transform: translateY(-50%);\n            display: none;\n        }\n        .chat-messages {\n            padding: 12px;\n            overflow-y: auto;\n            flex: 1;\n            background-color: #fff;\n            max-height: 440px;\n        }\n        .message {\n            margin-bottom: 10px;\n            padding: 10px;\n            border-radius: 6px;\n            font-size: 14px;\n            line-height: 1.5;\n        }\n        .bot-message {\n            background-color: #17a2b8;\n            color: #fff;\n            text-align: left;\n        }\n\n        .chat-input {\n            display: flex;\n            align-items: center;\n            background-color: #c3e6cb;\n            padding: 10px;\n            justify-content: space-between;\n            flex-wrap: wrap;\n        }\n        .send-button, .stop-button {\n            background-color: #17a2b8;\n            color: #fff;\n            font-weight: bold;\n            border: none;\n            border-radius: 5px;\n            padding: 12px 16px;\n            cursor: pointer;\n            transition: background-color 0.3s;\n            flex: 1;\n            margin: 6px;\n            max-width: 150px;\n            font-size: 16px;\n        }\n        .stop-button { background-color: #dc3545; }\n        .send-button:hover,\n        .stop-button:hover,\n        .send-button:focus,\n        .stop-button:focus {\n            background-color: #218838;\n            outline: none;\n        }\n\n        .voice-selection {\n            margin: 10px 0;\n            width: 100%;\n            max-width: 300px;\n        }\n        .voice-selection label {\n            display: block;\n            margin-bottom: 5px;\n            font-weight: bold;\n            color: #333;\n        }\n        .voice-selection select {\n            width: 100%;\n            padding: 8px;\n            border-radius: 5px;\n            border: 1px solid #ccc;\n            font-size: 14px;\n        }\n\n        .loader {\n            border: 4px solid #f3f3f3;\n            border-top: 4px solid #17a2b8;\n            border-radius: 50%;\n            width: 20px;\n            height: 20px;\n            animation: spin 2s linear infinite;\n            display: inline-block;\n            margin-left: 10px;\n        }\n        @keyframes spin {\n            0% { transform: rotate(0deg); }\n            100% { transform: rotate(360deg); }\n        }\n\n        .short-answer-input,\n        .blank-input {\n            width: 100%;\n            max-width: 280px;\n            padding: 4px 6px;\n            font-size: 13px;\n            border-radius: 4px;\n            border: 1px solid #ccc;\n        }\n\n        .topic-block {\n            margin-top: 4px;\n            padding: 4px 6px;\n            border-radius: 4px;\n        }\n\n        .mc-options label {\n            display: inline-block;\n            margin-right: 10px;\n            cursor: pointer;\n        }\n\n        .correct { background-color: #d4edda !important; }\n        .incorrect { background-color: #f8d7da !important; }\n        .unanswered { background-color: #fff3cd !important; }\n\n        @media (orientation: portrait) {\n            .image-chat-wrapper { flex-direction: column; }\n            .image-container, .chat-container {\n                width: 100%;\n                max-width: 100%;\n            }\n        }\n        @media (orientation: landscape) and (min-width: 700px) {\n            .image-chat-wrapper {\n                flex-direction: row;\n                justify-content: space-between;\n            }\n            .image-container, .chat-container {\n                width: 48%;\n                max-width: 48%;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"menu\">\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-conversation\/\">Conversation<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-vocabulary\/\">Vocabulary<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-real-life\/\">Real Life<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-describing-pictures\/\">Describing Pictures<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-reading-comprehension\/\">Reading<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-listening\/\">Listening<\/a>\n    <\/div>\n\n    <div class=\"container\">\n        <div class=\"image-chat-wrapper\">\n            <div class=\"image-container\">\n                <!-- Replace with Lucy\u2019s photo if you like -->\n                <img decoding=\"async\" src=\"http:\/\/asiacall.info\/wp-content\/uploads\/2025\/12\/12.png\"\n                     alt=\"Lucy talking about her plans after graduation\">\n                <div class=\"sentence-text\">\n                    Lucy is talking about what she hopes to do after graduation. Listen and complete the tasks.\n                <\/div>\n\n                <div class=\"audio-player\">\n                    <!-- \ud83d\udd0a Change src to real Track 90 URL -->\n                    <audio id=\"lucy-audio\" controls>\n                        <source src=\"\/mnt\/data\/BTP_L1_SB_090.mp3\" type=\"audio\/mpeg\">\n                        Your browser does not support the audio element.\n                    <\/audio>\n                <\/div>\n\n                <button id=\"play-script-btn\" class=\"script-button\" type=\"button\">\n                    Play Script (Robot Voices)\n                <\/button>\n\n                <div id=\"word-box\" class=\"word-box\">\n                    PART 1 \u2013 Listen and check (\u2713) the topics Lucy mentions.<br>\n                    1 health &nbsp;&nbsp; 2 work &nbsp;&nbsp; 3 friends &nbsp;&nbsp; 4 marriage &nbsp;&nbsp; 5 travel &nbsp;&nbsp; 6 money<br><br>\n                    PART 2 \u2013 Listen again and complete the sentences.\n                <\/div>\n            <\/div>\n\n            <div class=\"chat-container\">\n                <div class=\"chat-header\">\n                    <h2>Listening \u2013 Lucy\u2019s Future Plans<\/h2>\n                    <div class=\"loader\" id=\"synthesis-loader\"><\/div>\n                <\/div>\n                <div class=\"chat-messages\" id=\"chat-messages\"><\/div>\n                <div class=\"chat-input\">\n                    <div class=\"voice-selection\">\n                        <label for=\"voice-select\">Choose Voice for Feedback:<\/label>\n                        <select id=\"voice-select\" aria-label=\"Select Voice\">\n                            <option value=\"\">Loading voices&#8230;<\/option>\n                        <\/select>\n                    <\/div>\n                    <button id=\"start-btn\" class=\"send-button\" aria-label=\"Check Answers\">Check Answers<\/button>\n                    <button id=\"stop-btn\" class=\"stop-button\" aria-label=\"Stop Voice\">Stop Voice<\/button>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <div class=\"menu\">\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-conversation\/\">Conversation<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-vocabulary\/\">Vocabulary<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-real-life\/\">Real Life<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-describing-pictures\/\">Describing Pictures<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-reading-comprehension\/\">Reading<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/hopes-and-intentions-listening\/\">Listening<\/a>\n    <\/div>\n\n<script>\n\/* ============================\n   Listening \u2013 Lucy\u2019s Future Plans\n   ============================ *\/\n\n\/* Script: Interviewer = I, Lucy = L *\/\nconst listeningScript = `I: You\u2019re a student right now, Lucy. Is that right?\nL: Yes, but my final exams are next June, so \u2026\nI: Do you know what you are going to do after that? Are you going to travel abroad, for example?\nL: No, I\u2019m going to find a job.\nI: What kind of job do you want?\nL: I want to be a police officer in the LAPD. That\u2019s the Los Angeles Police Department. I\u2019m going to take a test in the summer.\nI: That sounds hard! Another exam!\nL: Yes, but it\u2019s what I want to do. They have a good training course.\nI: What about family? Do you have any plans to marry or have children?\nL: I have a boyfriend. His name\u2019s Mick. We\u2019re going to get married next year.\nI: That\u2019s great!\nL: Thanks. We\u2019d like to have children. But the police force is a hard job, so Mick\u2019s going to stay home and take care of the children.\nI: OK. So he\u2019s going to be a househusband!\nL: Yes. And I\u2019m going to earn the money!`;\n\n\/* PART 1 \u2013 topics (check boxes) *\/\nconst topics = [\n  { id: 1, label: \"health\",    correct: false },\n  { id: 2, label: \"work\",      correct: true  },\n  { id: 3, label: \"friends\",   correct: false },\n  { id: 4, label: \"marriage\",  correct: true  },\n  { id: 5, label: \"travel\",    correct: true  }, \/\/ interviewer mentions travel abroad\n  { id: 6, label: \"money\",     correct: true  }  \/\/ \u201cI\u2019m going to earn the money!\u201d\n];\n\n\/* PART 2 \u2013 sentence blanks *\/\nconst blanks = [\n  {\n    id: \"june\",\n    text: \"1) Lucy is going to take her final exams next ________.\",\n    answers: [\"june\"]\n  },\n  {\n    id: \"job\",\n    text: \"2) Then she\u2019d like to ____________.\",\n    answers: [\"find a job\",\"get a job\"]\n  },\n  {\n    id: \"police\",\n    text: \"3) She wants to be a ____________.\",\n    answers: [\"police officer\",\"policewoman\",\"a police officer\"]\n  },\n  {\n    id: \"test\",\n    text: \"4) She\u2019s going to ____________ in the summer.\",\n    answers: [\"take a test\",\"take the test\"]\n  },\n  {\n    id: \"marry\",\n    text: \"5) She\u2019s going to ____________ Mick next year.\",\n    answers: [\"marry\",\"marry mick\",\"get married\",\"get married to mick\"]\n  },\n  {\n    id: \"stayhome\",\n    text: \"6) Mick\u2019s going to ____________ and take care of the children.\",\n    answers: [\"stay home\",\"stay at home\",\"stay home and take care of the children\"]\n  }\n];\n\nconst summaryMessages = [\n  \"Nice listening! Keep going.\",\n  \"Good job. Listen again and try to improve your score.\",\n  \"You\u2019re doing well. Practice this activity again later.\"\n];\n\nconst positiveMessages = [\n  \"Excellent comprehension!\",\n  \"Great work! You understood Lucy\u2019s plans.\",\n  \"Very good! Your answers match the audio quite well.\"\n];\n\n\/* Speech synthesis *\/\nconst speechSynthesisSupported = \"speechSynthesis\" in window;\nlet voices = [];\nlet selectedVoice = null;\nlet interviewerVoice = null;\nlet lucyVoice = null;\n\nconst desiredVoiceNames = [\n  \"Google US English\",\n  \"Google US English Female\",\n  \"Google UK English Male\",\n  \"Google UK English Female\"\n];\n\n\/* ========== INIT ========== *\/\n\nfunction initialize() {\n  loadVoices();\n\n  if (!speechSynthesisSupported) {\n    appendMessage(\"Sorry, your browser does not support speech synthesis.\", \"bot\");\n  }\n\n  document.getElementById(\"start-btn\").onclick = checkAnswers;\n  document.getElementById(\"stop-btn\").onclick = stopSpeaking;\n  document.getElementById(\"play-script-btn\").onclick = playScript;\n\n  buildTasks();\n\n  const intro =\n    \"First, listen to Lucy talk about what she hopes to do after graduation. Then listen again, check the topics, and complete the sentences.\";\n  appendMessage(intro, \"bot\");\n  if (speechSynthesisSupported) {\n    showSynthesisLoader(true);\n    sayText(intro, \"en-US\").then(() => showSynthesisLoader(false));\n  }\n}\n\n\/* ========== VOICES ========== *\/\n\nfunction loadVoices() {\n  if (!speechSynthesisSupported) return;\n  voices = window.speechSynthesis.getVoices();\n  if (voices.length === 0) {\n    window.speechSynthesis.onvoiceschanged = () => {\n      voices = window.speechSynthesis.getVoices();\n      populateVoiceList();\n    };\n  } else {\n    populateVoiceList();\n  }\n}\n\nfunction chooseDialogueVoices(filteredVoices) {\n  interviewerVoice =\n    filteredVoices.find(v => \/male\/i.test(v.name)) ||\n    filteredVoices.find(v => \/UK English Male\/i.test(v.name)) ||\n    filteredVoices[0];\n\n  lucyVoice =\n    filteredVoices.find(v => v !== interviewerVoice && \/female\/i.test(v.name)) ||\n    filteredVoices.find(v => v !== interviewerVoice) ||\n    interviewerVoice;\n}\n\nfunction populateVoiceList() {\n  const voiceSelect = document.getElementById(\"voice-select\");\n  voiceSelect.innerHTML = \"\";\n\n  if (!speechSynthesisSupported) {\n    const option = document.createElement(\"option\");\n    option.value = \"\";\n    option.textContent = \"No voices available\";\n    voiceSelect.appendChild(option);\n    voiceSelect.disabled = true;\n    return;\n  }\n\n  const filteredVoices = voices.filter(v =>\n    desiredVoiceNames.includes(v.name) || v.lang.startsWith(\"en-\")\n  );\n\n  if (filteredVoices.length === 0) {\n    const option = document.createElement(\"option\");\n    option.value = \"\";\n    option.textContent = \"Default browser voice\";\n    voiceSelect.appendChild(option);\n    voiceSelect.disabled = true;\n    return;\n  }\n\n  filteredVoices.forEach((v, index) => {\n    const option = document.createElement(\"option\");\n    option.value = index;\n    option.textContent = `${v.name} (${v.lang})`;\n    voiceSelect.appendChild(option);\n  });\n\n  voiceSelect.selectedIndex = 0;\n  selectedVoice = filteredVoices[0];\n\n  chooseDialogueVoices(filteredVoices);\n\n  voiceSelect.onchange = () => {\n    const idx = voiceSelect.value;\n    selectedVoice = filteredVoices[idx];\n  };\n}\n\n\/* ========== BUILD UI ========== *\/\n\nfunction buildTasks() {\n  const chat = document.getElementById(\"chat-messages\");\n  chat.innerHTML = \"\";\n\n  \/\/ PART 1 \u2013 topics\n  const p1Title = document.createElement(\"h3\");\n  p1Title.textContent = \"PART 1 \u2013 Check (\u2713) the topics Lucy mentions.\";\n  p1Title.style.margin = \"4px 0\";\n  p1Title.style.fontSize = \"16px\";\n  chat.appendChild(p1Title);\n\n  topics.forEach(t => {\n    const block = document.createElement(\"div\");\n    block.className = \"topic-block\";\n    block.id = `topic-${t.id}`;\n\n    const label = document.createElement(\"label\");\n    const checkbox = document.createElement(\"input\");\n    checkbox.type = \"checkbox\";\n    checkbox.id = `topic-input-${t.id}`;\n    checkbox.style.marginRight = \"4px\";\n\n    label.appendChild(checkbox);\n    label.appendChild(document.createTextNode(` ${t.id}) ${t.label}`));\n\n    block.appendChild(label);\n    chat.appendChild(block);\n  });\n\n  \/\/ PART 2 \u2013 blanks\n  const p2Title = document.createElement(\"h3\");\n  p2Title.textContent = \"PART 2 \u2013 Listen again and complete the sentences.\";\n  p2Title.style.marginTop = \"10px\";\n  p2Title.style.fontSize = \"16px\";\n  chat.appendChild(p2Title);\n\n  blanks.forEach(b => {\n    const wrapper = document.createElement(\"div\");\n    wrapper.style.marginBottom = \"6px\";\n    wrapper.id = `blank-${b.id}`;\n\n    const label = document.createElement(\"label\");\n    label.textContent = b.text;\n    label.style.display = \"block\";\n    label.style.marginBottom = \"2px\";\n\n    const input = document.createElement(\"input\");\n    input.type = \"text\";\n    input.className = \"blank-input\";\n    input.id = `blank-input-${b.id}`;\n\n    wrapper.appendChild(label);\n    wrapper.appendChild(input);\n    chat.appendChild(wrapper);\n  });\n}\n\n\/* ========== CHECK ANSWERS ========== *\/\n\nfunction checkAnswers() {\n  let score = 0;\n  let unanswered = 0;\n  const totalPart1 = topics.length;\n  const totalPart2 = blanks.length;\n\n  \/\/ Reset styles\n  topics.forEach(t => {\n    const block = document.getElementById(`topic-${t.id}`);\n    block.classList.remove(\"correct\",\"incorrect\",\"unanswered\");\n  });\n  blanks.forEach(b => {\n    const w = document.getElementById(`blank-${b.id}`);\n    w.classList.remove(\"correct\",\"incorrect\",\"unanswered\");\n  });\n\n  \/\/ PART 1\n  topics.forEach(t => {\n    const block = document.getElementById(`topic-${t.id}`);\n    const input = document.getElementById(`topic-input-${t.id}`);\n    const checked = input.checked;\n\n    if (!checked && !t.correct && !input.indeterminate) {\n      \/\/ this one is fine but we count only graded items; do nothing\n      return;\n    }\n\n    if (!checked && t.correct) {\n      unanswered++;          \/\/ treat as unanswered\/incorrect\n      block.classList.add(\"incorrect\");\n    } else if (checked && t.correct) {\n      score++;\n      block.classList.add(\"correct\");\n    } else if (checked && !t.correct) {\n      block.classList.add(\"incorrect\");\n    }\n  });\n\n  \/\/ PART 2\n  blanks.forEach(b => {\n    const w = document.getElementById(`blank-${b.id}`);\n    const input = document.getElementById(`blank-input-${b.id}`);\n    const value = input.value.trim().toLowerCase();\n\n    if (!value) {\n      unanswered++;\n      w.classList.add(\"unanswered\");\n      return;\n    }\n\n    const correct = b.answers.some(ans => value === ans.toLowerCase());\n    if (correct) {\n      score++;\n      w.classList.add(\"correct\");\n    } else {\n      w.classList.add(\"incorrect\");\n    }\n  });\n\n  const totalItems = totalPart1 + totalPart2;\n  const resultMessage =\n    `You got ${score} out of ${totalItems} items correct.` +\n    (unanswered > 0 ? ` (${unanswered} item(s) not answered or incomplete.)` : \"\");\n\n  appendMessage(resultMessage, \"bot\");\n\n  let extra;\n  if (score === totalItems && unanswered === 0) {\n    extra = \"Perfect score! \" + positiveMessages[Math.floor(Math.random() * positiveMessages.length)];\n  } else if (score >= Math.round(totalItems * 0.7)) {\n    extra = positiveMessages[Math.floor(Math.random() * positiveMessages.length)];\n  } else {\n    extra = summaryMessages[Math.floor(Math.random() * summaryMessages.length)];\n  }\n\n  appendMessage(extra, \"bot\");\n\n  if (speechSynthesisSupported) {\n    showSynthesisLoader(true);\n    sayText(resultMessage + \" \" + extra, \"en-US\").then(() => {\n      showSynthesisLoader(false);\n    });\n  }\n}\n\n\/* ========== SCRIPT PLAYER WITH TWO VOICES (I & L) ========== *\/\n\nfunction playScript() {\n  if (!speechSynthesisSupported) {\n    appendMessage(\"Your browser cannot play the script with robot voices.\", \"bot\");\n    return;\n  }\n  if (!interviewerVoice || !lucyVoice) {\n    appendMessage(\"Voices are still loading. Please wait a moment and try again.\", \"bot\");\n    loadVoices();\n    return;\n  }\n\n  stopSpeaking();\n  showSynthesisLoader(true);\n\n  const lines = listeningScript.split(\"\\n\").map(l => l.trim()).filter(l => l.length > 0);\n\n  function speakLine(index) {\n    if (index >= lines.length) {\n      showSynthesisLoader(false);\n      return;\n    }\n\n    let line = lines[index];\n    let voiceForLine = selectedVoice || voices[0];\n    let text = line;\n\n    if (line.startsWith(\"I:\")) {\n      text = line.replace(\/^I:\\s*\/, \"\");\n      voiceForLine = interviewerVoice || voiceForLine;\n    } else if (line.startsWith(\"L:\")) {\n      text = line.replace(\/^L:\\s*\/, \"\");\n      voiceForLine = lucyVoice || voiceForLine;\n    }\n\n    const utterance = new SpeechSynthesisUtterance(text);\n    utterance.lang = \"en-US\";\n    utterance.rate = 1.0;\n    utterance.pitch = 1.0;\n    utterance.voice = voiceForLine;\n\n    utterance.onend = () => speakLine(index + 1);\n    utterance.onerror = () => speakLine(index + 1);\n\n    window.speechSynthesis.speak(utterance);\n  }\n\n  speakLine(0);\n}\n\n\/* ========== SPEECH HELPERS ========== *\/\n\nfunction stopSpeaking() {\n  if (speechSynthesisSupported) {\n    window.speechSynthesis.cancel();\n    showSynthesisLoader(false);\n  }\n}\n\nfunction sayText(text, lang) {\n  return new Promise(resolve => {\n    if (!speechSynthesisSupported) {\n      resolve();\n      return;\n    }\n    const utterance = new SpeechSynthesisUtterance(text);\n    utterance.lang = lang;\n    utterance.rate = 1.0;\n    utterance.pitch = 1.0;\n    if (selectedVoice) utterance.voice = selectedVoice;\n\n    utterance.onend = () => resolve();\n    utterance.onerror = () => resolve();\n\n    window.speechSynthesis.speak(utterance);\n  });\n}\n\n\/* ========== UI HELPERS ========== *\/\n\nfunction appendMessage(text, sender) {\n  const container = document.getElementById(\"chat-messages\");\n  const el = document.createElement(\"div\");\n  el.classList.add(\"message\",\"bot-message\");\n  el.innerText = text;\n  container.appendChild(el);\n  container.scrollTop = container.scrollHeight;\n}\n\nfunction showSynthesisLoader(show) {\n  const loader = document.getElementById(\"synthesis-loader\");\n  loader.style.display = show ? \"inline-block\" : \"none\";\n  if (show) loader.style.borderTop = \"4px solid #17a2b8\";\n}\n\n\/* ========== START ========== *\/\nwindow.onload = initialize;\n<\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>This Robot is used for practicing English at level A2. In order to interact with this Robot smoothly, please use<\/p>\n","protected":false},"author":1,"featured_media":252,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_layout":"default_layout","footnotes":""},"categories":[18,5],"tags":[],"class_list":["post-415","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-a2","category-chatbot"],"_links":{"self":[{"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts\/415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/comments?post=415"}],"version-history":[{"count":1,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts\/415\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts\/415\/revisions\/416"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/media\/252"}],"wp:attachment":[{"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/media?parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/categories?post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/tags?post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}