{"id":1755,"date":"2024-09-30T06:59:07","date_gmt":"2024-09-30T06:59:07","guid":{"rendered":"https:\/\/phamho.com\/book\/?p=1755"},"modified":"2024-09-30T07:13:23","modified_gmt":"2024-09-30T07:13:23","slug":"korean-sentences-family","status":"publish","type":"post","link":"https:\/\/phamho.com\/book\/korean-sentences-family\/","title":{"rendered":"Korean Sentences &#8211; Family"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\"> <!-- Changed lang to English for consistency -->\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Korean Sentences &#8211; Family<\/title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            background-color: #ffffff;\n            margin: 0;\n            padding: 0;\n            display: flex;\n            flex-direction: column; \/* Stack elements vertically *\/\n            min-height: 100vh;\n        }\n        .menu {\n            width: 100%;\n            background-color: #0f7bd9; \/* Updated color for differentiation *\/\n            padding: 10px;\n            text-align: center;\n            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n            flex-shrink: 0;\n            overflow-x: auto;\n            white-space: nowrap;\n        }\n        .menu a {\n            color: #fff;\n            text-decoration: none;\n            margin: 0 8px;\n            font-weight: bold;\n            font-size: 14px;\n            display: inline-block;\n        }\n        .menu a:hover {\n            text-decoration: underline;\n        }\n        .container {\n            display: flex;\n            flex-wrap: wrap;\n            flex: 1 0 auto;\n            padding: 10px;\n            box-sizing: border-box;\n            justify-content: center;\n        }\n        .image-container, .chat-container {\n            width: 100%;\n            max-width: 600px;\n            margin-bottom: 20px;\n        }\n        .image-container {\n            text-align: center;\n        }\n        .image-container img {\n            width: 100%;\n            height: auto;\n            border-radius: 20px;\n            box-shadow: 0 0 10px 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        .sentence-box {\n            margin-top: 10px;\n            padding: 10px;\n            background-color: #fff;\n            border: 2px solid #096c02; \/* Updated color for differentiation *\/\n            border-radius: 10px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n            font-size: 18px;\n            font-weight: bold;\n            color: #096c02;\n            text-align: left;\n            max-height: 300px;\n            overflow-y: auto;\n        }\n        .chat-container {\n            background-color: #096c02; \/* Updated color for differentiation *\/\n            border-radius: 20px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n            overflow: hidden;\n        }\n        .chat-header {\n            background-color: #0f7bd9; \/* Updated color for differentiation *\/\n            color: #fff;\n            padding: 10px;\n            text-align: center;\n            border-bottom: 1px solid #0a6901;\n        }\n        .chat-header h2 {\n            margin: 0;\n            font-size: 18px;\n        }\n        .chat-messages {\n            padding: 10px;\n            overflow-y: auto;\n            max-height: 300px;\n            background-color: #fff;\n        }\n        .message {\n            margin-bottom: 10px;\n            padding: 10px;\n            border-radius: 5px;\n            font-size: 14px;\n            line-height: 1.4;\n        }\n        .user-message {\n            background-color: #4caf50;\n            color: #fff;\n            text-align: right;\n        }\n        .bot-message {\n            background-color: #2196f3;\n            color: #fff;\n            text-align: left;\n        }\n        .chat-input {\n            display: flex;\n            align-items: center;\n            background-color: #a3e106;\n            padding: 10px;\n            justify-content: center;\n        }\n        .send-button, .stop-button {\n            background-color: #17c686;\n            color: #fff;\n            font-weight: bold;\n            border: none;\n            border-radius: 5px;\n            padding: 8px 10px;\n            cursor: pointer;\n            transition: background-color 0.3s;\n            flex: 1;\n            margin: 0 5px;\n            max-width: 150px;\n            font-size: 14px;\n        }\n        .stop-button {\n            background-color: #c86722;\n        }\n        .chat-input input {\n            flex: 2;\n            padding: 8px;\n            margin-right: 10px;\n            border: 2px solid #096c02; \/* Updated color for differentiation *\/\n            border-radius: 5px;\n            font-size: 16px;\n        }\n\n        \/* Optional: Voice Selection Dropdown Styling *\/\n        .voice-selection {\n            margin-top: 10px;\n            text-align: center;\n        }\n        .voice-selection select {\n            padding: 5px;\n            font-size: 14px;\n            border-radius: 5px;\n            border: 1px solid #ccc;\n        }\n\n        \/* Adjustments for smaller screens *\/\n        @media (max-width: 600px) {\n            .menu a {\n                margin: 0 5px;\n                font-size: 12px;\n            }\n            .sentence-text {\n                font-size: 14px;\n            }\n            .sentence-box {\n                font-size: 14px;\n                max-height: 200px;\n            }\n            .chat-header h2 {\n                font-size: 16px;\n            }\n            .chat-messages {\n                max-height: 200px;\n            }\n            .message {\n                font-size: 13px;\n            }\n            .send-button, .stop-button {\n                padding: 6px 8px;\n                font-size: 12px;\n                max-width: 120px;\n            }\n            .chat-input input {\n                font-size: 14px;\n            }\n        }\n        @media (max-width: 400px) {\n            .menu a {\n                margin: 0 3px;\n                font-size: 11px;\n            }\n            .sentence-text {\n                font-size: 13px;\n            }\n            .sentence-box {\n                font-size: 13px;\n                max-height: 150px;\n            }\n            .chat-header h2 {\n                font-size: 14px;\n            }\n            .chat-messages {\n                max-height: 150px;\n            }\n            .message {\n                font-size: 12px;\n            }\n            .send-button, .stop-button {\n                padding: 5px 6px;\n                font-size: 11px;\n                max-width: 100px;\n            }\n            .chat-input input {\n                font-size: 12px;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"menu\">\n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-vocabulary-family\/\">Vocabulary<\/a>\n      <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-sentences-family\/\">Sentences<\/a>\n      <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-yes-no-question-family\/\">Yes\/No Questions<\/a>\n      <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-wh-question-family\/\">WH-Questions<\/a>\n      <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-like-question-family\/\">Like-Questions<\/a>\n      <a href=\"https:\/\/phamho.com\/book\/2024\/09\/30\/korean-interaction-family\/\">Interactions<\/a>  \n    <\/div>\n\n    <div class=\"container\">\n        <div class=\"image-container\">\n            <img decoding=\"async\" src=\"https:\/\/phamho.com\/book\/wp-content\/uploads\/2024\/09\/korean.jpg\" alt=\"Lesson Robot\">\n            <div class=\"sentence-text\">Check the sentences in this box<\/div>\n            <div id=\"sentence-box\" class=\"sentence-box\">\n                <!-- Learned family-related sentences will be displayed here -->\n            <\/div>\n            <!-- Optional: Voice Selection Dropdown -->\n            <div class=\"voice-selection\">\n                <label for=\"voice-select\">Choose Korean Voice: <\/label>\n                <select id=\"voice-select\" aria-label=\"Select Korean Voice\">\n                    <option value=\"\">Default<\/option>\n                    <!-- Korean voices will be populated here -->\n                <\/select>\n            <\/div>\n        <\/div>\n        <div class=\"chat-container\">\n            <div class=\"chat-header\">  \n              <h2>Korean Sentences &#8211; Family<\/h2>\n            <\/div>\n            <div class=\"chat-messages\" id=\"chat-messages\">\n                <!-- Messages will appear here -->\n            <\/div>\n            <div class=\"chat-input\">\n                <input type=\"text\" id=\"user-input\" placeholder=\"Type your answer here...\" style=\"display: none;\" aria-label=\"User Input\" \/>\n                <button id=\"submit-btn\" class=\"send-button\" style=\"display: none;\" aria-label=\"Submit Answer\">Submit<\/button>\n                <button id=\"start-btn\" class=\"send-button\" aria-label=\"Start Lesson\">Start Lesson<\/button>\n                <button id=\"stop-btn\" class=\"stop-button\" aria-label=\"Stop Lesson\">Stop<\/button>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <script>\n    const sentences = [\n        { sentence: \"\uc774\uac83\uc740 \uc800\uc758 \uac00\uc871\uc785\ub2c8\ub2e4.\", translation: \"This is my family.\" },\n        { sentence: \"\uc800\ub294 \ub450 \uba85\uc758 \ud615\uc81c\uac00 \uc788\uc2b5\ub2c8\ub2e4.\", translation: \"I have two siblings.\" },\n        { sentence: \"\uc544\ubc84\uc9c0\ub294 \ud68c\uc0ac\uc5d0\uc11c \uc77c\ud558\uc2ed\ub2c8\ub2e4.\", translation: \"My father works at a company.\" },\n        { sentence: \"\uc5b4\uba38\ub2c8\ub294 \uc694\ub9ac\ub97c \uc798 \ud558\uc2ed\ub2c8\ub2e4.\", translation: \"My mother is good at cooking.\" },\n        { sentence: \"\ud560\uc544\ubc84\uc9c0\ub294 \uc815\uc6d0\uc744 \uac00\uafb8\uc2ed\ub2c8\ub2e4.\", translation: \"My grandfather tends the garden.\" },\n        { sentence: \"\ud560\uba38\ub2c8\ub294 \ub9e4\uc77c \uc2e0\ubb38\uc744 \uc77d\uc73c\uc2ed\ub2c8\ub2e4.\", translation: \"My grandmother reads the newspaper every day.\" },\n        { sentence: \"\uc800\ub294 \uc544\ub4e4\uacfc \ub538\uc774 \uc788\uc2b5\ub2c8\ub2e4.\", translation: \"I have a son and a daughter.\" },\n        { sentence: \"\uc800\uc758 \ud615\uc740 \ub300\ud559\uc0dd\uc785\ub2c8\ub2e4.\", translation: \"My older brother is a university student.\" },\n        { sentence: \"\uc800\uc758 \ub204\ub098\ub294 \uac04\ud638\uc0ac\ub85c \uc77c\ud569\ub2c8\ub2e4.\", translation: \"My older sister works as a nurse.\" },\n        { sentence: \"\uc800\ud76c \uac00\uc871\uc740 \uc8fc\ub9d0\ub9c8\ub2e4 \ud568\uaed8 \uc2dc\uac04\uc744 \ubcf4\ub0c5\ub2c8\ub2e4.\", translation: \"My family spends time together every weekend.\" },\n        { sentence: \"\uc0bc\ucd0c\uc740 \uc5ec\ud589\uc744 \uc88b\uc544\ud558\uc2ed\ub2c8\ub2e4.\", translation: \"My uncle likes to travel.\" },\n        { sentence: \"\uc774\ubaa8\ub294 \uadf8\ub9bc \uadf8\ub9ac\ub294 \uac83\uc744 \uc990\uae41\ub2c8\ub2e4.\", translation: \"My aunt enjoys painting.\" },\n        { sentence: \"\uc0ac\ucd0c\ub4e4\uc740 \ubaa8\ub450 \uc800\uc640 \ube44\uc2b7\ud55c \ub098\uc774\uc785\ub2c8\ub2e4.\", translation: \"All my cousins are around the same age as me.\" },\n        { sentence: \"\ub0a8\ud3b8\uc740 \ub9e4\uc77c \uc544\uce68 \uc6b4\ub3d9\uc744 \ud569\ub2c8\ub2e4.\", translation: \"My husband exercises every morning.\" },\n        { sentence: \"\uc544\ub0b4\ub294 \uc9c1\uc7a5\uc5d0\uc11c \uc5f4\uc2ec\ud788 \uc77c\ud569\ub2c8\ub2e4.\", translation: \"My wife works hard at her job.\" },\n        { sentence: \"\ubd80\ubaa8\ub2d8\uc740 \ud56d\uc0c1 \uc800\ub97c \uc751\uc6d0\ud574 \uc8fc\uc2ed\ub2c8\ub2e4.\", translation: \"My parents always support me.\" },\n        { sentence: \"\uc870\ubd80\ubaa8\ub2d8\uacfc \uc790\uc8fc \ub9cc\ub098\ub7ec \uac11\ub2c8\ub2e4.\", translation: \"I often go to visit my grandparents.\" },\n        { sentence: \"\ud615\uc81c\uc790\ub9e4\ub294 \uc11c\ub85c\ub97c \uc798 \uc774\ud574\ud569\ub2c8\ub2e4.\", translation: \"Siblings understand each other well.\" },\n        { sentence: \"\uac00\uc871\uacfc \ud568\uaed8 \uc2dd\uc0ac\ub97c \ud558\ub294 \uac83\uc744 \uc88b\uc544\ud569\ub2c8\ub2e4.\", translation: \"I like having meals with my family.\" },\n        { sentence: \"\uac00\uc871\uc740 \uc81c \uc778\uc0dd\uc5d0\uc11c \uac00\uc7a5 \uc911\uc694\ud55c \uc874\uc7ac\uc785\ub2c8\ub2e4.\", translation: \"Family is the most important part of my life.\" }\n    ];\n\n    let currentSentenceIndex = 0;\n    let repeatAttempts = 0;\n    let isSpeechRecognitionSupported = false;\n    let recognition;\n\n    const stopKeywords = [\"\uc548\ub155\", \"\uc798 \uac00\", \"\uad7f\ubc14\uc774\", \"bye\", \"bye bye\", \"byebye\", \"\ub610 \ub9cc\ub098\uc694\", \"\ucc98\uc74c \ubd59\uaca0\uc2b5\ub2c8\ub2e4\"];\n    const speechSynthesisSupported = 'speechSynthesis' in window;\n\n    let selectedVoice = null; \/\/ Variable to hold the selected voice\n\n    \/\/ Feature detection for Speech Recognition\n    if (window.SpeechRecognition || window.webkitSpeechRecognition) {\n        isSpeechRecognitionSupported = true;\n        recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();\n        recognition.lang = 'ko-KR';\n        recognition.interimResults = false;\n        recognition.maxAlternatives = 1;\n    }\n\n    \/\/ Function to populate the voice selection dropdown\n    function populateVoiceList() {\n        const voiceSelect = document.getElementById('voice-select');\n        const voices = speechSynthesis.getVoices().filter(voice => voice.lang === 'ko-KR');\n\n        voices.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        \/\/ If no Korean voices are found, inform the user\n        if (voices.length === 0) {\n            const option = document.createElement('option');\n            option.value = \"\";\n            option.textContent = \"No Korean voices available\";\n            voiceSelect.appendChild(option);\n        }\n    }\n\n    window.onload = function() {\n        if (speechSynthesisSupported) {\n            if (window.speechSynthesis.getVoices().length === 0) {\n                \/\/ Voices not loaded yet, wait for the event\n                window.speechSynthesis.onvoiceschanged = function() {\n                    populateVoiceList();\n                    greetUser();\n                };\n            } else {\n                \/\/ Voices already loaded\n                populateVoiceList();\n                greetUser();\n            }\n        } else {\n            alert('Sorry, your browser does not support speech synthesis. Please use a compatible browser for the best experience.');\n            appendMessage('Speech synthesis not supported in your browser.', 'bot');\n        }\n\n        if (!isSpeechRecognitionSupported) {\n            \/\/ Show text input and submit button\n            document.getElementById('user-input').style.display = 'block';\n            document.getElementById('submit-btn').style.display = 'block';\n            \/\/ Optionally hide the start button\n            \/\/ document.getElementById('start-btn').style.display = 'none';\n        }\n\n        \/\/ Event listener for voice selection\n        document.getElementById('voice-select').addEventListener('change', function() {\n            const selectedIndex = this.value;\n            const voices = speechSynthesis.getVoices().filter(voice => voice.lang === 'ko-KR');\n            if (selectedIndex !== \"\") {\n                selectedVoice = voices[selectedIndex];\n            } else {\n                selectedVoice = null; \/\/ Default voice\n            }\n        });\n    };\n\n    function greetUser() {\n        let greeting = \"Welcome! In this lesson, you will learn 20 sentences about family in Korean. I will say each sentence twice, and then you will repeat.\";\n        if (!isSpeechRecognitionSupported) {\n            greeting += \" Your browser does not support voice input, so please type your responses in the text box below.\";\n        }\n        greeting += \" Are you ready? Click Start Lesson to begin.\";\n        appendMessage(greeting, 'bot');\n        sayText(greeting, 'en');\n    }\n\n    document.getElementById('start-btn').onclick = function() {\n        currentSentenceIndex = 0;\n        repeatAttempts = 0;\n        startSentenceLesson();\n    };\n\n    document.getElementById('stop-btn').onclick = function() {\n        endLesson(true); \/\/ Stop the lesson when \"Stop\" button is clicked\n    };\n\n    \/\/ Handle submit button click\n    document.getElementById('submit-btn').onclick = function() {\n        let userInput = document.getElementById('user-input').value.trim().toLowerCase();\n        document.getElementById('user-input').value = '';\n        if (userInput) {\n            processUserResponse(userInput);\n        }\n    };\n\n    \/\/ Allow pressing 'Enter' to submit the answer\n    document.getElementById('user-input').addEventListener('keypress', function(event) {\n        if (event.key === 'Enter') {\n            event.preventDefault();\n            document.getElementById('submit-btn').click();\n        }\n    });\n\n    function startSentenceLesson() {\n        if (currentSentenceIndex < sentences.length) {\n            const sentence = sentences[currentSentenceIndex].sentence;\n            const translation = sentences[currentSentenceIndex].translation;\n\n            appendMessage(`'${sentence}' - '${translation}'`, 'bot');\n            addSentenceToBox(sentence, translation);\n            sayText(sentence, \"ko-KR\", function() {\n                setTimeout(() => {\n                    sayText(sentence, \"ko-KR\", function() {\n                        setTimeout(() => {\n                            if (isSpeechRecognitionSupported) {\n                                \/\/ Prompt user to repeat\n                                appendMessage(`Please repeat after me: '${sentence}'`, 'bot');\n                                sayText(\"Please repeat after me:\", \"en\", function() {\n                                    sayText(`${sentence}`, \"ko-KR\", function() {\n                                        listenUserResponse(sentence);\n                                    });\n                                });\n                            } else {\n                                \/\/ Prompt user to type\n                                appendMessage(`Please type the sentence '${sentence}' in the text box below.`, 'bot');\n                                sayText(`Please type the sentence '${sentence}' in the text box below.`, \"en\");\n                                \/\/ Focus the text input\n                                document.getElementById('user-input').focus();\n                            }\n                        }, 500); \/\/ Small pause before prompt\n                    });\n                }, 500); \/\/ Small pause before second repetition\n            });\n        } else {\n            endLesson();\n        }\n    }\n\n    function listenUserResponse(expectedSentence) {\n        recognition.start();\n\n        recognition.onresult = function(event) {\n            let userInput = event.results[0][0].transcript.trim().toLowerCase();\n            appendMessage(userInput, 'user');\n\n            processUserResponse(userInput, expectedSentence);\n        };\n\n        recognition.onspeechend = function() {\n            recognition.stop();\n        };\n\n        recognition.onerror = function(event) {\n            let errorMessage = '';\n            switch(event.error) {\n                case 'no-speech':\n                    errorMessage = 'No speech detected. Please try again or type your answer.';\n                    break;\n                case 'audio-capture':\n                    errorMessage = 'Microphone access denied. Please check your settings or type your answer.';\n                    break;\n                case 'not-allowed':\n                    errorMessage = 'Permission to use microphone denied.';\n                    break;\n                default:\n                    errorMessage = 'An error occurred: ' + event.error;\n            }\n            appendMessage(errorMessage, 'bot');\n            sayText(errorMessage, 'en');\n        };\n    }\n\n    function processUserResponse(userInput, expectedSentence = sentences[currentSentenceIndex].sentence) {\n        appendMessage(userInput, 'user');\n\n        if (stopKeywords.includes(userInput.toLowerCase())) {\n            endLesson(true); \/\/ User requested to stop the lesson\n            return;\n        }\n\n        \/\/ Normalize sentences by removing spaces and punctuation for comparison\n        const normalize = (str) => str.replace(\/\\s+\/g, '').replace(\/[.,\\\/#!$%\\^&\\*;:{}=\\-_`~()]\/g,\"\").toLowerCase();\n        if (normalize(userInput) === normalize(expectedSentence)) {\n            const positiveMessage = \"Great! Your pronunciation is good.\";\n            appendMessage(positiveMessage, 'bot');\n            sayText(positiveMessage, 'en'); \/\/ Feedback in English\n            repeatAttempts = 0; \/\/ Reset the attempts counter\n            currentSentenceIndex++;\n            setTimeout(startSentenceLesson, 2000); \/\/ Move to next sentence after 2 seconds\n        } else {\n            repeatAttempts++;\n            if (repeatAttempts < 2) {\n                appendMessage(`That's not correct. Listen again: '${expectedSentence}'. Now try again.`, 'bot');\n\n                \/\/ Split the message into parts\n                sayText(\"That's not correct. Listen again:\", 'en', function() {\n                    sayText(`${expectedSentence}`, 'ko-KR', function() {\n                        sayText(\"Now try again.\", 'en', function() {\n                            setTimeout(() => {\n                                if (isSpeechRecognitionSupported) {\n                                    \/\/ Prompt user to repeat\n                                    appendMessage(`Please repeat after me: '${expectedSentence}'`, 'bot');\n                                    sayText(\"Please repeat after me:\", \"en\", function() {\n                                        sayText(`${expectedSentence}`, \"ko-KR\", function() {\n                                            listenUserResponse(expectedSentence);\n                                        });\n                                    });\n                                } else {\n                                    \/\/ Focus the text input\n                                    document.getElementById('user-input').focus();\n                                }\n                            }, 500); \/\/ Small pause before prompt\n                        });\n                    });\n                });\n            } else {\n                const nextSentenceMessage = `You've tried twice. The correct sentence is '${expectedSentence}'. Let's move on to the next sentence.`;\n                appendMessage(nextSentenceMessage, 'bot');\n                sayText(nextSentenceMessage, 'en'); \/\/ Feedback in English\n                repeatAttempts = 0; \/\/ Reset the attempts counter\n                currentSentenceIndex++;\n                setTimeout(startSentenceLesson, 2000); \/\/ Move to next sentence after 2 seconds\n            }\n        }\n    }\n\n    function addSentenceToBox(sentence, translation) {\n        const sentenceBox = document.getElementById('sentence-box');\n        const sentenceElement = document.createElement('div');\n        sentenceElement.innerText = `'${sentence}' - '${translation}'`;\n        sentenceElement.style.cursor = 'pointer';\n        sentenceElement.style.padding = '5px';\n        sentenceElement.style.borderBottom = '1px solid #ccc';\n        sentenceElement.addEventListener('click', () => sayText(sentence, 'ko-KR'));\n        sentenceBox.appendChild(sentenceElement);\n    }\n\n    function endLesson(userStopped = false) {\n        let message;\n        if (userStopped) {\n            message = \"Thank you for learning today! I hope you enjoyed the lesson.\";\n        } else {\n            message = \"Well done! You've learned 20 sentences related to family. Keep practicing!\";\n        }\n        appendMessage(message, \"bot\");\n        sayText(message, \"en\"); \/\/ End feedback in English\n    }\n\n    function sayText(text, lang, callback) {\n        if (!speechSynthesisSupported) {\n            if (callback) callback();\n            return;\n        }\n        const utterance = new SpeechSynthesisUtterance(text);\n        utterance.lang = lang;\n        \/\/ Adjust rate and pitch for Korean\n        if (lang.startsWith('ko')) {\n            utterance.rate = 1.0;\n            utterance.pitch = 1.0;\n        } else {\n            utterance.rate = 1.0;\n            utterance.pitch = 1.0;\n        }\n\n        \/\/ Select the desired voice\n        if (lang.startsWith('ko')) {\n            if (selectedVoice) {\n                utterance.voice = selectedVoice;\n            } else {\n                \/\/ Filter voices to find native Korean voices\n                const koreanVoices = speechSynthesis.getVoices().filter(voice => voice.lang === 'ko-KR');\n                if (koreanVoices.length > 0) {\n                    \/\/ Prefer female voices for naturalness\n                    selectedVoice = koreanVoices.find(voice => voice.name.toLowerCase().includes('female')) || koreanVoices[0];\n                    utterance.voice = selectedVoice;\n                } else {\n                    \/\/ No native Korean voices found\n                    appendMessage(\"No native Korean voices available. Please install or enable Korean voices on your device for the best experience.\", 'bot');\n                    sayText(\"No native Korean voices available. Please install or enable Korean voices on your device for the best experience.\", 'en');\n                }\n            }\n        } else {\n            \/\/ For English or other languages, select the default voice\n            const voices = speechSynthesis.getVoices();\n            let selectedEnglishVoice = voices.find(voice => voice.lang === lang) || voices.find(voice => voice.lang.startsWith(lang));\n            if (selectedEnglishVoice) {\n                utterance.voice = selectedEnglishVoice;\n            }\n        }\n\n        utterance.onend = function() {\n            if (callback) callback();\n        };\n        window.speechSynthesis.speak(utterance);\n    }\n\n    function appendMessage(text, sender) {\n        const messageContainer = 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        messageContainer.appendChild(messageElement);\n        messageContainer.scrollTop = messageContainer.scrollHeight;\n    }\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Korean Sentences &#8211; Family Vocabulary Sentences Yes\/No Questions WH-Questions Like-Questions Interactions Check the sentences in this box Choose Korean Voice: Default Korean Sentences &#8211; Family Submit Start Lesson Stop<\/p>\n","protected":false},"author":1,"featured_media":354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,45,34],"tags":[],"class_list":["post-1755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-family-korean","category-korean","category-robots"],"featured_image_src":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2023\/02\/AAAABSo5pQNYvp0_fDnG0Cy_YHQfSb2PGmmsECxXdoLLCDUh1lT0gI679hw8-O57nNfC5WwTsHfh5Klb0-iU95EvRr8cDauN-1-1024x576.jpg","blog_images":{"medium":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2023\/02\/AAAABSo5pQNYvp0_fDnG0Cy_YHQfSb2PGmmsECxXdoLLCDUh1lT0gI679hw8-O57nNfC5WwTsHfh5Klb0-iU95EvRr8cDauN-1-300x169.jpg","large":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2023\/02\/AAAABSo5pQNYvp0_fDnG0Cy_YHQfSb2PGmmsECxXdoLLCDUh1lT0gI679hw8-O57nNfC5WwTsHfh5Klb0-iU95EvRr8cDauN-1-1024x576.jpg"},"ams_acf":[],"_links":{"self":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/comments?post=1755"}],"version-history":[{"count":2,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1755\/revisions"}],"predecessor-version":[{"id":1768,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1755\/revisions\/1768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/media\/354"}],"wp:attachment":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/media?parent=1755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/categories?post=1755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/tags?post=1755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}