{"id":405,"date":"2025-12-03T06:54:34","date_gmt":"2025-12-03T06:54:34","guid":{"rendered":"https:\/\/i-cte.org\/robot\/?p=405"},"modified":"2025-12-03T06:54:34","modified_gmt":"2025-12-03T06:54:34","slug":"life-stories-real-life","status":"publish","type":"post","link":"https:\/\/i-cte.org\/robot\/life-stories-real-life\/","title":{"rendered":"Life Stories &#8211; Real Life"},"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>Famous People \u2013 Conversations<\/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: 800px;\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: 300px;\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: 16px;\n            font-weight: bold;\n            color: #28a745;\n            text-align: left;\n            max-height: 250px;\n            overflow-y: auto;\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: 500px;\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: 300px;\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        .user-message {\n            background-color: #ffc107;\n            color: #fff;\n            text-align: right;\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 {\n            background-color: #dc3545;\n        }\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        @media (orientation: portrait) {\n            .image-chat-wrapper {\n                flex-direction: column;\n            }\n            .image-container, .chat-container {\n                width: 100%;\n                max-width: 100%;\n            }\n        }\n\n        @media (orientation: landscape) and (min-width: 600px) {\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            .word-box { max-height: 200px; }\n            .chat-header h2 { font-size: 20px; }\n            .message { font-size: 15px; }\n            .send-button, .stop-button {\n                font-size: 18px;\n                padding: 14px 20px;\n                max-width: 200px;\n            }\n        }\n\n        @media (max-width: 768px) {\n            .chat-header h2 { font-size: 16px; }\n            .message { font-size: 14px; }\n            .send-button, .stop-button {\n                font-size: 16px;\n                padding: 12px 16px;\n                max-width: 150px;\n            }\n            .word-box { font-size: 15px; }\n            .voice-selection select { font-size: 14px; }\n        }\n\n        @media only screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) {\n            .chat-header h2 { font-size: 18px; }\n            .send-button, .stop-button {\n                padding: 14px 18px;\n                font-size: 16px;\n            }\n            .message { font-size: 14px; }\n            .word-box { font-size: 16px; }\n        }\n    <\/style>\n<\/head>\n<body>\n    <!-- Adjust links if you add this to a series -->\n    <div class=\"menu\">\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-conversation\/\">Conversation<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-vocabulary\/\">Vocabulary<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-real-life\/\">Real Life<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-describing-pictures\/\">Describing Pictures<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-reading-comprehension\/\">Reading<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-listening\/\">Listening<\/a>\n    <\/div>\n\n    <div class=\"container\">\n        <div class=\"image-chat-wrapper\">\n            <div class=\"image-container\">\n                <img decoding=\"async\" src=\"https:\/\/i-cte.org\/robot\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-05-13-18.46.33-A-single-small-academic-themed-robot-instructor-designed-to-teach-in-a-classroom.-The-robot-is-knee-high-sleek-and-professional-looking-wearing-dig-1.webp\" alt=\"Robot teacher talking about famous people\">\n                <div class=\"sentence-text\">\n                    Use all the words in each list to talk about a famous person. Answer in full sentences in the past simple.\n                <\/div>\n                <div id=\"word-box\" class=\"word-box\"><\/div>\n            <\/div>\n\n            <div class=\"chat-container\">\n                <div class=\"chat-header\">\n                    <h2>Famous People \u2013 Conversations<\/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:<\/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=\"Start Lesson\">Start<\/button>\n                    <button id=\"stop-btn\" class=\"stop-button\" aria-label=\"Stop Lesson\">Stop<\/button>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <div class=\"menu\">\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-conversation\/\">Conversation<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-vocabulary\/\">Vocabulary<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-real-life\/\">Real Life<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-describing-pictures\/\">Describing Pictures<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-reading-comprehension\/\">Reading<\/a>\n<a href=\"https:\/\/i-cte.org\/robot\/life-stories-listening\/\">Listening<\/a>\n    <\/div>\n\n<script>\n    \/\/ Picture vocabulary:\n    \/\/ Conversation 1: Mozart, Austria, 1756, wrote great music, in 1782, six, 1791\n    \/\/ Conversation 2: Steve Jobs, San Francisco, 1955, was head of Apple Inc., once, four, 2011\n    \/\/ Conversation 3: Akira Kurosawa, Japan, 1910, made great movies, in 1945, two, 1998\n\n    const questions = [\n        {\n            label: \"Conversation 1\",\n            personName: \"Mozart\",\n            promptIntro: \"First, let\u2019s talk about Mozart.\",\n            english: \"Can you talk about Mozart? Use the words to say where he was from, when he was born, what he did, and when he died.\",\n            words: [\n                \"Mozart\",\n                \"Austria\",\n                \"1756\",\n                \"wrote great music\",\n                \"in 1782\",\n                \"six\",\n                \"1791\"\n            ],\n            keywords: [\n                \"mozart\",\n                \"austria\",\n                \"1756\",\n                \"wrote great music\",\n                \"great music\",\n                \"1782\",\n                \"six\",\n                \"1791\"\n            ],\n            exampleAnswer:\n                \"Mozart was from Austria. He was born in 1756. He wrote great music. In 1782 he wrote six famous pieces, and he died in 1791.\"\n        },\n        {\n            label: \"Conversation 2\",\n            personName: \"Steve Jobs\",\n            promptIntro: \"Now, let\u2019s talk about Steve Jobs.\",\n            english: \"Can you talk about Steve Jobs? Use the words to say where he was born, what he did at Apple, his family, and when he died.\",\n            words: [\n                \"Steve Jobs\",\n                \"San Francisco\",\n                \"1955\",\n                \"was head of Apple Inc.\",\n                \"once\",\n                \"four\",\n                \"2011\"\n            ],\n            keywords: [\n                \"steve jobs\",\n                \"san francisco\",\n                \"1955\",\n                \"was head of apple\",\n                \"head of apple inc\",\n                \"once\",\n                \"four\",\n                \"2011\"\n            ],\n            exampleAnswer:\n                \"Steve Jobs was born in San Francisco in 1955. He was head of Apple Inc. He was married once and had four children. He died in 2011.\"\n        },\n        {\n            label: \"Conversation 3\",\n            personName: \"Akira Kurosawa\",\n            promptIntro: \"Finally, let\u2019s talk about Akira Kurosawa.\",\n            english: \"Can you talk about Akira Kurosawa? Use the words to say where he was from, when he was born, what he did, and when he died.\",\n            words: [\n                \"Akira Kurosawa\",\n                \"Japan\",\n                \"1910\",\n                \"made great movies\",\n                \"in 1945\",\n                \"two\",\n                \"1998\"\n            ],\n            keywords: [\n                \"akira kurosawa\",\n                \"japan\",\n                \"1910\",\n                \"made great movies\",\n                \"great movies\",\n                \"1945\",\n                \"two\",\n                \"1998\"\n            ],\n            exampleAnswer:\n                \"Akira Kurosawa was from Japan. He was born in 1910. He made great movies. In 1945 he made two important movies. He died in 1998.\"\n        }\n    ];\n\n    const positiveFeedback = [\n        \"Great job! You used the information very well.\",\n        \"Well done! Your description sounds clear and natural.\",\n        \"Excellent! You used many of the words from the list.\",\n        \"Very good. Your answer is detailed and correct.\",\n        \"Fantastic! Nice use of the past simple and years.\",\n        \"You\u2019re talking about famous people very well. Keep going!\",\n        \"Nice! You used several of the dates and facts.\"\n    ];\n\n    const constructiveFeedback = [\n        \"Try to use more of the words from the list, for example: the country and the years.\",\n        \"Can you include the year of birth and the year of death?\",\n        \"Please use the past simple: he was, he was born, he wrote, he made.\",\n        \"Try to say at least two or three sentences about this person.\",\n        \"Include expressions like wrote great music, was head of Apple Inc., or made great movies.\",\n        \"Make your answer longer: talk about what he did and when he lived.\",\n        \"Use full sentences: He was from\u2026, He was born in\u2026, He died in\u2026.\",\n    ];\n\n    const pronunciationFeedback = [\n        \"Good job! Practice saying \u201cAustria\u201d and \u201cMozart\u201d clearly.\",\n        \"Nice answer! Try repeating \u201cSan Francisco\u201d and \u201cApple Inc.\u201d smoothly.\",\n        \"Well spoken! Focus on the name \u201cAkira Kurosawa\u201d.\",\n        \"Great effort! Repeat: \u201cHe made great movies in 1945.\u201d\",\n        \"Very good! Try saying: \u201cHe was born in 1955 and died in 2011.\u201d\"\n    ];\n\n    const stopKeywords = [\"goodbye\", \"good bye\", \"bye\", \"bye-bye\", \"byebye\"];\n\n    let currentQuestionIndex = 0;\n    let recognition;\n    let isLessonActive = false;\n    let speechRecognitionActive = false;\n\n    const speechSynthesisSupported = 'speechSynthesis' in window;\n    const speechRecognitionSupported = window.SpeechRecognition || window.webkitSpeechRecognition;\n\n    let voices = [];\n    let selectedVoice = null;\n\n    const desiredVoiceNames = [\n        'Google US English',\n        'Google US English Female',\n        'Google UK English Male',\n        'Google UK English Female'\n    ];\n\n    function initialize() {\n        loadVoices();\n\n        if (speechSynthesisSupported) {\n            setTimeout(greetUser, 500);\n        } else {\n            appendMessage(\"Sorry, your browser does not support speech synthesis.\", \"bot\");\n        }\n\n        if (!speechRecognitionSupported) {\n            appendMessage(\"Sorry, your browser does not support speech recognition.\", \"bot\");\n        }\n\n        document.getElementById('start-btn').onclick = function () {\n            if (isLessonActive) return;\n\n            if (!speechSynthesisSupported) {\n                appendMessage(\"Speech synthesis is not supported in your browser.\", \"bot\");\n                return;\n            }\n            if (!speechRecognitionSupported) {\n                appendMessage(\"Speech recognition is not supported in your browser.\", \"bot\");\n                return;\n            }\n\n            isLessonActive = true;\n            currentQuestionIndex = 0;\n            clearWordBox();\n            startLesson();\n        };\n\n        document.getElementById('stop-btn').onclick = function () {\n            if (recognition && speechRecognitionActive) {\n                recognition.stop();\n                speechRecognitionActive = false;\n            }\n            endLesson(true);\n        };\n    }\n\n    function loadVoices() {\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\n    function populateVoiceList() {\n        const voiceSelect = document.getElementById('voice-select');\n        voiceSelect.innerHTML = '';\n\n        const filteredVoices = voices.filter(v => desiredVoiceNames.includes(v.name));\n\n        if (filteredVoices.length === 0) {\n            const option = document.createElement('option');\n            option.value = \"\";\n            option.textContent = \"No desired voices available\";\n            voiceSelect.appendChild(option);\n            voiceSelect.disabled = true;\n            return;\n        }\n\n        filteredVoices.forEach((voice, index) => {\n            const option = document.createElement('option');\n            option.value = index;\n            option.textContent = `${voice.name} (${voice.lang})`;\n            voiceSelect.appendChild(option);\n        });\n\n        voiceSelect.selectedIndex = 0;\n        selectedVoice = filteredVoices[0];\n\n        voiceSelect.onchange = () => {\n            const selectedIndex = voiceSelect.value;\n            selectedVoice = filteredVoices[selectedIndex];\n        };\n    }\n\n    function greetUser() {\n        const greeting =\n            \"Hello! In this lesson we will talk about famous people using words like Mozart, Austria, 1756, Steve Jobs, Apple Inc., Japan, and 1998. Click Start to begin.\";\n        appendMessage(greeting, \"bot\");\n        showSynthesisLoader(true);\n        sayText(greeting, \"en-US\").then(() => showSynthesisLoader(false));\n    }\n\n    function startLesson() {\n        if (!isLessonActive) return;\n\n        if (currentQuestionIndex < questions.length) {\n            const q = questions[currentQuestionIndex];\n            const number = currentQuestionIndex + 1;\n\n            clearWordBox();\n            addSentenceToBox(q.label);\n            addSentenceToBox(\"Person: \" + q.personName);\n            addSentenceToBox(\"Use ALL these words:\");\n            q.words.forEach(w => addSentenceToBox(\"\u2022 \" + w));\n            addSentenceToBox(\"Example answer:\");\n            addSentenceToBox(q.exampleAnswer);\n\n            const questionText = `Conversation ${number}. ${q.english}`;\n\n            appendMessage(q.label + \" \u2013 \" + q.personName, \"bot\");\n            appendMessage(questionText, \"bot\");\n\n            showSynthesisLoader(true);\n            const toSay = `${q.promptIntro} Here are the words: ${q.words.join(\", \")}. ${q.english}`;\n            sayText(toSay, \"en-US\").then(() => {\n                showSynthesisLoader(false);\n                listenUserResponse(q);\n            });\n        } else {\n            endLesson(false);\n        }\n    }\n\n    function listenUserResponse(question) {\n        if (!speechRecognitionSupported) return;\n\n        recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();\n        recognition.lang = \"en-US\";\n        recognition.interimResults = false;\n        recognition.maxAlternatives = 1;\n\n        showRecognitionLoader(true);\n        appendMessage(\"Listening...\", \"bot\");\n        speechRecognitionActive = true;\n        recognition.start();\n\n        recognition.onresult = function (event) {\n            if (!speechRecognitionActive) return;\n\n            const userInput = event.results[0][0].transcript.trim();\n            const formattedInput = normalizeAndFormatUserInput(userInput);\n\n            appendMessage(formattedInput, \"user\");\n            addSentenceToBox(\"Your answer: \" + formattedInput);\n\n            showRecognitionLoader(false);\n            speechRecognitionActive = false;\n\n            if (checkStopKeywords(formattedInput.toLowerCase())) {\n                endLesson(true);\n                return;\n            }\n\n            let feedbackMessage = \"\";\n            const grammarFeedback = checkGrammar(formattedInput);\n\n            if (grammarFeedback) {\n                feedbackMessage = grammarFeedback;\n            } else {\n                const feedbackType = analyzeResponse(formattedInput, question.keywords);\n                if (feedbackType === \"pronunciation\") {\n                    feedbackMessage =\n                        pronunciationFeedback[Math.floor(Math.random() * pronunciationFeedback.length)];\n                } else if (feedbackType === \"positive\") {\n                    feedbackMessage = positiveFeedback[Math.floor(Math.random() * positiveFeedback.length)];\n                } else {\n                    feedbackMessage =\n                        constructiveFeedback[Math.floor(Math.random() * constructiveFeedback.length)];\n                }\n            }\n\n            appendMessage(feedbackMessage, \"bot\");\n            showSynthesisLoader(true);\n            sayText(feedbackMessage, \"en-US\").then(() => {\n                showSynthesisLoader(false);\n                currentQuestionIndex++;\n                setTimeout(startLesson, 2500);\n            });\n        };\n\n        recognition.onspeechend = function () {\n            if (speechRecognitionActive) {\n                recognition.stop();\n                speechRecognitionActive = false;\n                showRecognitionLoader(false);\n            }\n        };\n\n        recognition.onerror = function (event) {\n            showRecognitionLoader(false);\n            speechRecognitionActive = false;\n            let msg = \"Error: \" + event.error;\n\n            if (event.error === \"not-allowed\") {\n                msg = \"Microphone access was not allowed. Please allow microphone access and try again.\";\n            }\n\n            appendMessage(msg, \"bot\");\n\n            const retryMessage = \"Let's try that conversation again.\";\n            appendMessage(retryMessage, \"bot\");\n            showSynthesisLoader(true);\n            sayText(retryMessage, \"en-US\").then(() => {\n                showSynthesisLoader(false);\n                setTimeout(() => listenUserResponse(question), 2500);\n            });\n        };\n    }\n\n    function analyzeResponse(userInput, keywords) {\n        const text = userInput.toLowerCase();\n        for (let keyword of keywords) {\n            if (text.includes(keyword.toLowerCase())) {\n                if (\n                    keyword.toLowerCase().includes(\"mozart\") ||\n                    keyword.toLowerCase().includes(\"steve jobs\") ||\n                    keyword.toLowerCase().includes(\"akira kurosawa\")\n                ) {\n                    return \"pronunciation\";\n                }\n                return \"positive\";\n            }\n        }\n        return \"constructive\";\n    }\n\n    \/\/ Simple grammar help for talking about people in the past\n    function checkGrammar(userInput) {\n        const lower = userInput.toLowerCase();\n\n        if (lower.includes(\"he is born\") || lower.includes(\"mozart is born\") || lower.includes(\"jobs is born\")) {\n            return 'You can say: \"He was born in 1756\" or \"He was born in 1955.\" Use was born for the past.';\n        }\n        if (lower.includes(\"he is from\") && (lower.includes(\"1910\") || lower.includes(\"1955\") || lower.includes(\"1756\"))) {\n            return 'Try: \"He was from Austria\" or \"He was from Japan.\" Use was for someone who is dead.';\n        }\n        if (lower.includes(\"he write great music\")) {\n            return 'You can say: \"He wrote great music.\" (past form: wrote).';\n        }\n        if (lower.includes(\"he make great movies\")) {\n            return 'You can say: \"He made great movies.\" (past form: made).';\n        }\n        if (lower.includes(\"he is head of apple\") && lower.includes(\"died\")) {\n            return 'You can say: \"He was head of Apple Inc.\" (past simple).';\n        }\n\n        return null;\n    }\n\n    function checkStopKeywords(userInput) {\n        const pattern = new RegExp(\"\\\\b(\" + stopKeywords.join(\"|\") + \")\\\\b\", \"i\");\n        return pattern.test(userInput);\n    }\n\n    function normalizeAndFormatUserInput(text) {\n        let normalized = text.replace(\/\\bi\\b\/g, \"I\");\n        return formatSentence(normalized);\n    }\n\n    function formatSentence(text) {\n        if (!text) return text;\n        text = text.charAt(0).toUpperCase() + text.slice(1);\n\n        const questionWords = [\n            \"who\",\"what\",\"where\",\"when\",\"why\",\"how\",\n            \"is\",\"are\",\"do\",\"does\",\"can\",\"should\",\"will\",\"would\",\"did\"\n        ];\n        const firstWord = text.split(\" \")[0].toLowerCase();\n\n        if (questionWords.includes(firstWord) && !text.endsWith(\"?\")) {\n            text += \"?\";\n        } else if (!text.endsWith(\".\") && !text.endsWith(\"?\")) {\n            text += \".\";\n        }\n\n        return text;\n    }\n\n    function addSentenceToBox(sentence) {\n        const box = document.getElementById(\"word-box\");\n        const div = document.createElement(\"div\");\n        div.innerText = sentence;\n        box.appendChild(div);\n        box.scrollTop = box.scrollHeight;\n    }\n\n    function clearWordBox() {\n        document.getElementById(\"word-box\").innerHTML = \"\";\n    }\n\n    function endLesson(userStopped = false) {\n        if (speechSynthesisSupported) {\n            window.speechSynthesis.cancel();\n        }\n        if (recognition && speechRecognitionActive) {\n            recognition.stop();\n            speechRecognitionActive = false;\n        }\n\n        isLessonActive = false;\n\n        let message;\n        if (userStopped) {\n            message = \"Thank you for talking about famous people today. Goodbye!\";\n        } else {\n            message = \"Well done! You finished all three conversations. Keep practicing your stories about famous people!\";\n        }\n        appendMessage(message, \"bot\");\n        showSynthesisLoader(true);\n        sayText(message, \"en-US\").then(() => showSynthesisLoader(false));\n    }\n\n    function 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\n            if (selectedVoice) {\n                utterance.voice = selectedVoice;\n            }\n\n            utterance.onend = () => resolve();\n            utterance.onerror = () => resolve();\n\n            window.speechSynthesis.speak(utterance);\n        });\n    }\n\n    function appendMessage(text, sender) {\n        const container = document.getElementById(\"chat-messages\");\n        const messageElement = document.createElement(\"div\");\n        messageElement.classList.add(\"message\");\n        messageElement.classList.add(sender === \"bot\" ? \"bot-message\" : \"user-message\");\n        messageElement.innerText = text;\n        container.appendChild(messageElement);\n        container.scrollTop = container.scrollHeight;\n    }\n\n    function showSynthesisLoader(show) {\n        const loader = document.getElementById(\"synthesis-loader\");\n        loader.style.display = show ? \"inline-block\" : \"none\";\n        if (show) {\n            loader.style.borderTop = \"4px solid #17a2b8\";\n        }\n    }\n\n    function showRecognitionLoader(show) {\n        const loader = document.getElementById(\"synthesis-loader\");\n        if (show) {\n            loader.style.display = \"inline-block\";\n            loader.style.borderTop = \"4px solid #ffc107\";\n        } else {\n            loader.style.display = \"none\";\n        }\n    }\n\n    window.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":175,"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-405","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\/405","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=405"}],"version-history":[{"count":1,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/posts\/405\/revisions\/406"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/media\/175"}],"wp:attachment":[{"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i-cte.org\/robot\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}