{"id":1648,"date":"2024-09-18T14:01:05","date_gmt":"2024-09-18T14:01:05","guid":{"rendered":"https:\/\/phamho.com\/book\/?p=1648"},"modified":"2024-09-19T06:59:01","modified_gmt":"2024-09-19T06:59:01","slug":"spanish-interaction-family","status":"publish","type":"post","link":"https:\/\/phamho.com\/book\/spanish-interaction-family\/","title":{"rendered":"Spanish Interaction &#8211; Family"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Spanish Interaction &#8211; Family<\/title>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> <!-- Viewport meta tag for responsiveness -->\n    <style>\n        \/* Base styles *\/\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: #d97b0f;\n            padding: 10px 5px;\n            text-align: center;\n            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n            flex-shrink: 0;\n            overflow-x: auto; \/* Allow horizontal scrolling *\/\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: 10px;\n            box-shadow: 0 0 5px 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 #026c96;\n            border-radius: 5px;\n            box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n            font-size: 16px;\n            font-weight: bold;\n            color: #026c96;\n            text-align: left;\n            max-height: 200px;\n            overflow-y: auto;\n        }\n        .chat-container {\n            background-color: #026c96;\n            border-radius: 10px;\n            box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n            overflow: hidden;\n        }\n        .chat-header {\n            background-color: #d97b0f;\n            color: #fff;\n            padding: 10px;\n            text-align: center;\n            border-bottom: 1px solid #69010a;\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: 200px;\n            background-color: #fff;\n        }\n        .message {\n            margin-bottom: 10px;\n            padding: 8px;\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        \/* 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            .word-box {\n                font-size: 14px;\n                max-height: 150px;\n            }\n            .chat-header h2 {\n                font-size: 16px;\n            }\n            .chat-messages {\n                max-height: 150px;\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        }\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            .word-box {\n                font-size: 13px;\n                max-height: 120px;\n            }\n            .chat-header h2 {\n                font-size: 14px;\n            }\n            .chat-messages {\n                max-height: 120px;\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        }\n    <\/style>\n<\/head>\n<body>\n    <div class=\"menu\">\n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/16\/spanish-vocabulary\/\">Vocabulary<\/a>\n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/17\/spanish-sentences-family\/\">Sentences<\/a>\n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/17\/spanish-yes-no-questions\/\">Yes\/No Questions<\/a>\n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/17\/spanish-wh-questions-family\/\">WH Questions<\/a>  \n        <a href=\"https:\/\/phamho.com\/book\/2024\/09\/18\/spanish-interaction-family\/\">Internactions<\/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\/DALL\u00b7E-2024-09-15-18.17.33-A-classroom-scene-where-advanced-robots-are-teaching-English-to-B1-level-students.-The-robots-have-a-humanoid-design-with-sleek-metallic-bodies-and-f.webp\" alt=\"Lesson Robot\">\n            <div class=\"sentence-text\">See the questions and answers in this box<\/div>\n            <div id=\"word-box\" class=\"word-box\">\n                <!-- Learned questions will appear here -->\n            <\/div>\n        <\/div>\n        <div class=\"chat-container\">\n            <div class=\"chat-header\">  \n                <h2>Spanish Interaction &#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                <button id=\"start-btn\" class=\"send-button\">Start Lesson<\/button>\n                <button id=\"stop-btn\" class=\"stop-button\">Stop<\/button>\n            <\/div>\n        <\/div>\n    <\/div>\n\n    <script>\n        \/\/ Feature detection for Speech Recognition\n        const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;\n        const isSpeechRecognitionSupported = SpeechRecognition !== undefined;\n        let recognition;\n        if (isSpeechRecognitionSupported) {\n            recognition = new SpeechRecognition();\n            recognition.lang = 'es-ES';\n            recognition.interimResults = false;\n            recognition.maxAlternatives = 1;\n        } else {\n            alert('Your browser does not support speech recognition. Please use a compatible browser like Firefox for Android.');\n        }\n    \n        \/\/ Check for Speech Synthesis support\n        const speechSynthesisSupported = 'speechSynthesis' in window;\n    \n        \/\/ Questions data\n        const questions = [\n            { \n                question: \"\u00bfC\u00f3mo se llama tu padre?\", \n                translation: \"What is your father's name?\",\n                keywords: [\"se llama\", \"padre\"], \n                sampleAnswer: \"Mi padre se llama Juan.\",\n                sampleTranslation: \"My father's name is Juan.\"\n            },\n            { \n                question: \"\u00bfTienes hermanos o hermanas?\", \n                translation: \"Do you have brothers or sisters?\",\n                keywords: [\"hermano\", \"hermana\"], \n                sampleAnswer: \"S\u00ed, tengo un hermano y una hermana.\",\n                sampleTranslation: \"Yes, I have a brother and a sister.\"\n            },\n            { \n              question: \"\u00bfCu\u00e1ntos a\u00f1os tiene tu madre?\", \n              translation: \"How old is your mother?\",\n              keywords: [\"a\u00f1os\", \"madre\", \"45\"], \n              sampleAnswer: \"Mi madre tiene cuarenta y cinco a\u00f1os.\",\n              sampleTranslation: \"My mother is forty-five years old.\"\n          },\n          { \n              question: \"\u00bfD\u00f3nde vive tu familia?\", \n              translation: \"Where does your family live?\",\n              keywords: [\"vive\", \"familia\"], \n              sampleAnswer: \"Mi familia vive en Madrid.\",\n              sampleTranslation: \"My family lives in Madrid.\"\n          },\n          { \n              question: \"\u00bfC\u00f3mo es tu padre?\", \n              translation: \"What is your father like?\",\n              keywords: [\"es\", \"padre\"], \n              sampleAnswer: \"Mi padre es alto y amable.\",\n              sampleTranslation: \"My father is tall and kind.\"\n          },\n          { \n              question: \"\u00bfQu\u00e9 hace tu madre?\", \n              translation: \"What does your mother do?\",\n              keywords: [\"hace\", \"madre\"], \n              sampleAnswer: \"Mi madre es profesora.\",\n              sampleTranslation: \"My mother is a teacher.\"\n          },\n          { \n              question: \"\u00bfTienes abuelos?\", \n              translation: \"Do you have grandparents?\",\n              keywords: [\"abuelos\"], \n              sampleAnswer: \"S\u00ed, tengo dos abuelos y una abuela.\",\n              sampleTranslation: \"Yes, I have two grandfathers and one grandmother.\"\n          },\n          { \n              question: \"\u00bfCu\u00e1ntos primos tienes?\", \n              translation: \"How many cousins do you have?\",\n              keywords: [\"primos\", \"5\"], \n              sampleAnswer: \"Tengo cinco primos.\",\n              sampleTranslation: \"I have five cousins.\"\n          },\n          { \n              question: \"\u00bfVisitas a tus t\u00edos a menudo?\", \n              translation: \"Do you visit your uncles and aunts often?\",\n              keywords: [\"visitas\", \"t\u00edos\"], \n              sampleAnswer: \"S\u00ed, visito a mis t\u00edos cada mes.\",\n              sampleTranslation: \"Yes, I visit my uncles and aunts every month.\"\n          },\n          { \n              question: \"\u00bfTienes hijos?\", \n              translation: \"Do you have children?\",\n              keywords: [\"hijos\"], \n              sampleAnswer: \"No, no tengo hijos.\",\n              sampleTranslation: \"No, I don't have children.\"\n          },\n          { \n              question: \"\u00bfQui\u00e9n es el mayor en tu familia?\", \n              translation: \"Who is the oldest in your family?\",\n              keywords: [\"mayor\", \"familia\"], \n              sampleAnswer: \"Mi abuelo es el mayor en mi familia.\",\n              sampleTranslation: \"My grandfather is the oldest in my family.\"\n          },\n          { \n              question: \"\u00bfQui\u00e9n es el menor en tu familia?\", \n              translation: \"Who is the youngest in your family?\",\n              keywords: [\"menor\", \"familia\"], \n              sampleAnswer: \"Mi hermana peque\u00f1a es la menor.\",\n              sampleTranslation: \"My little sister is the youngest.\"\n          },\n          { \n              question: \"\u00bfC\u00f3mo es tu casa familiar?\", \n              translation: \"What is your family house like?\",\n              keywords: [\"casa\", \"familiar\"], \n              sampleAnswer: \"Mi casa familiar es grande y c\u00f3moda.\",\n              sampleTranslation: \"My family house is big and comfortable.\"\n          },\n          { \n              question: \"\u00bfQu\u00e9 actividades haces con tu familia?\", \n              translation: \"What activities do you do with your family?\",\n              keywords: [\"actividades\", \"familia\"], \n              sampleAnswer: \"Vamos al parque y cenamos juntos.\",\n              sampleTranslation: \"We go to the park and have dinner together.\"\n          },\n          { \n              question: \"\u00bfTienes mascotas en tu familia?\", \n              translation: \"Do you have pets in your family?\",\n              keywords: [\"mascotas\", \"familia\"], \n              sampleAnswer: \"S\u00ed, tenemos un perro y un gato.\",\n              sampleTranslation: \"Yes, we have a dog and a cat.\"\n          },\n          { \n              question: \"\u00bfC\u00f3mo celebras los cumplea\u00f1os en tu familia?\", \n              translation: \"How do you celebrate birthdays in your family?\",\n              keywords: [\"celebras\", \"cumplea\u00f1os\", \"familia\"], \n              sampleAnswer: \"Hacemos una fiesta y comemos pastel.\",\n              sampleTranslation: \"We have a party and eat cake.\"\n          },\n          { \n              question: \"\u00bfQui\u00e9n cocina en tu familia?\", \n              translation: \"Who cooks in your family?\",\n              keywords: [\"cocina\", \"familia\"], \n              sampleAnswer: \"Mi madre y yo cocinamos en casa.\",\n              sampleTranslation: \"My mother and I cook at home.\"\n          },\n          { \n              question: \"\u00bfCompartes habitaci\u00f3n con alguien?\", \n              translation: \"Do you share a room with someone?\",\n              keywords: [\"compartes\", \"habitaci\u00f3n\"], \n              sampleAnswer: \"S\u00ed, comparto habitaci\u00f3n con mi hermano.\",\n              sampleTranslation: \"Yes, I share a room with my brother.\"\n          },\n          { \n              question: \"\u00bfQu\u00e9 le gusta hacer a tu padre?\", \n              translation: \"What does your father like to do?\",\n              keywords: [\"le gusta\", \"padre\"], \n              sampleAnswer: \"A mi padre le gusta leer libros.\",\n              sampleTranslation: \"My father likes to read books.\"\n          },\n          { \n              question: \"\u00bfD\u00f3nde trabajan tus padres?\", \n              translation: \"Where do your parents work?\",\n              keywords: [\"trabajan\", \"padres\"], \n              sampleAnswer: \"Mis padres trabajan en una oficina.\",\n              sampleTranslation: \"My parents work in an office.\"\n          }\n            \/\/ ... (Include the rest of your questions here)\n        ];\n    \n        let currentQuestionIndex = 0;\n        let repeatAttempts = 0;\n        const stopKeywords = [\"adi\u00f3s\", \"byebye\", \"chao\", \"bye\", \"bye bye\", \"good bye\", \"stop\", \"goodbye\"];\n        let lessonStarted = false;\n        let voicesLoaded = false;\n    \n        window.addEventListener('load', 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                        if (!voicesLoaded) {\n                            voicesLoaded = true;\n                            greetUser();\n                        }\n                    };\n                } else {\n                    \/\/ Voices already loaded\n                    voicesLoaded = true;\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    \n        function greetUser() {\n            const greeting = \"Welcome! In this lesson, I will ask you 20 simple questions about family in Spanish. I will repeat each question twice. Click 'Start Lesson' to begin.\";\n            appendMessage(greeting, 'bot');\n            sayText(greeting, 'en', true);\n        }\n    \n        document.getElementById('start-btn').addEventListener('click', function() {\n            if (!isSpeechRecognitionSupported) {\n                alert('Speech recognition is not supported in your browser. The lesson cannot proceed.');\n                return;\n            }\n            currentQuestionIndex = 0;\n            repeatAttempts = 0;\n            lessonStarted = true;\n            startLesson();\n        });\n    \n        document.getElementById('stop-btn').addEventListener('click', function() {\n            endLesson(true); \/\/ User stopped the lesson\n        });\n    \n        function startLesson() {\n            if (currentQuestionIndex < questions.length) {\n                const questionObj = questions[currentQuestionIndex];\n                const formattedQuestion = formatSentence(questionObj.question);\n    \n                appendMessage(`Question: '${formattedQuestion}'`, 'bot');\n                addQuestionToBox(formattedQuestion, questionObj.translation, questionObj.sampleAnswer, questionObj.sampleTranslation);\n    \n                \/\/ Say the question in Spanish twice\n                sayText(formattedQuestion, \"es\", false, function() {\n                    sayText(formattedQuestion, \"es\", false, function() {\n                        \/\/ Prompt user to answer (Removed the sentence as per your request)\n                        listenUserResponse(questionObj);\n                    });\n                });\n            } else {\n                endLesson();\n            }\n        }\n    \n        function listenUserResponse(questionObj) {\n            recognition.start();\n    \n            recognition.onresult = function(event) {\n                let userInput = event.results[0][0].transcript.trim();\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                processUserResponse(userInput, questionObj);\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.';\n                        break;\n                    case 'audio-capture':\n                        errorMessage = 'Microphone access denied. Please check your settings.';\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', true);\n            };\n        }\n    \n        function processUserResponse(userInput, questionObj) {\n            \/\/ Normalize user's response\n            let normalizedUserInput = normalizeSentence(userInput);\n            normalizedUserInput = normalizeNumbers(normalizedUserInput);\n    \n            \/\/ Normalize keywords\n            let normalizedKeywords = questionObj.keywords.map(keyword => normalizeNumbers(normalizeSentence(keyword)));\n    \n            \/\/ Check for keywords in the user's response\n            let keywordsFound = normalizedKeywords.filter(keyword => normalizedUserInput.includes(keyword));\n    \n            if (keywordsFound.length === normalizedKeywords.length) {\n                const positiveMessage = \"Great! You have a good answer.\";\n                appendMessage(positiveMessage, 'bot');\n                sayText(positiveMessage, 'en', true);\n                repeatAttempts = 0; \/\/ Reset attempts counter\n                currentQuestionIndex++;\n                setTimeout(startLesson, 2000); \/\/ Move to next question after 2 seconds\n            } else {\n                repeatAttempts++;\n                if (repeatAttempts < 2) {\n                    const missingKeywords = questionObj.keywords.filter((keyword, index) => !normalizedUserInput.includes(normalizedKeywords[index]));\n                    const correctionMessage = `I didn't hear the words: ${missingKeywords.join(', ')}. Please try again.`;\n                    appendMessage(correctionMessage, 'bot');\n                    sayText(correctionMessage, 'en', true);\n                    setTimeout(() => listenUserResponse(questionObj), 2000); \/\/ Give the user another chance\n                } else {\n                    \/\/ Provide sample answer\n                    const sampleAnswerMessage = `Here's a sample answer: '${questionObj.sampleAnswer}'.`;\n                    appendMessage(sampleAnswerMessage, 'bot');\n                    sayText(\"Here's a sample answer.\", 'en', true, () => {\n                        sayText(questionObj.sampleAnswer, 'es', false, () => {\n                            \/\/ Proceed to the next question\n                            repeatAttempts = 0;\n                            currentQuestionIndex++;\n                            setTimeout(startLesson, 2000);\n                        });\n                    });\n                }\n            }\n        }\n    \n        function addQuestionToBox(question, translation, sampleAnswer, sampleTranslation) {\n            const wordBox = document.getElementById('word-box');\n            const questionElement = document.createElement('div');\n            questionElement.innerHTML = `<strong>Q:<\/strong> '${question}' - '${translation}'<br><strong>A:<\/strong> '${sampleAnswer}' - '${sampleTranslation}'`;\n            wordBox.appendChild(questionElement);\n        }\n    \n        function endLesson(userStopped = false) {\n            lessonStarted = false;\n            let message;\n            if (userStopped) {\n                message = \"Thank you for participating! I hope you enjoyed the lesson.\";\n            } else {\n                message = \"Well done! You've answered all the questions about family. Keep practicing!\";\n            }\n            appendMessage(message, \"bot\");\n            sayText(message, \"en\", true);\n        }\n    \n        function sayText(text, lang, preferFemale, callback) {\n            if (!speechSynthesisSupported) return;\n            const utterance = new SpeechSynthesisUtterance(text);\n            utterance.lang = lang;\n    \n            \/\/ Adjust rate and pitch for Spanish to improve naturalness\n            if (lang.startsWith('es')) {\n                utterance.rate = 0.9; \/\/ Slightly slower\n                utterance.pitch = 1.1; \/\/ Slightly higher pitch\n            } else {\n                utterance.rate = 1.0;\n                utterance.pitch = 1.0;\n            }\n    \n            const voices = window.speechSynthesis.getVoices();\n    \n            let selectedVoice = null;\n    \n            \/\/ Preferred voices for Spanish and English\n            const preferredVoices = {\n                'es': ['Google espa\u00f1ol', 'Microsoft Helena - Spanish (Spain)', 'Microsoft Sabina - Spanish (Mexico)'],\n                'en': ['Google US English', 'Microsoft Zira Desktop - English (United States)', 'Samantha']\n            };\n    \n            const preferredVoiceNames = preferredVoices[lang.substring(0, 2)] || [];\n    \n            for (let voiceName of preferredVoiceNames) {\n                selectedVoice = voices.find(voice => voice.name === voiceName);\n                if (selectedVoice) break;\n            }\n    \n            if (!selectedVoice) {\n                \/\/ Fallback to any voice that matches the language\n                selectedVoice = voices.find(voice => voice.lang.startsWith(lang));\n            }\n    \n            if (selectedVoice) {\n                utterance.voice = selectedVoice;\n            }\n    \n            utterance.onend = function() {\n                if (callback) callback();\n            };\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    \n        function formatSentence(sentence) {\n            \/\/ Capitalize the first letter and ensure proper punctuation at the end\n            sentence = sentence.trim();\n            if (sentence.length === 0) return sentence;\n            let firstChar = sentence.charAt(0).toUpperCase();\n            let restOfSentence = sentence.slice(1);\n            let formattedSentence = firstChar + restOfSentence;\n    \n            \/\/ Ensure question marks at the beginning and end\n            if (!formattedSentence.startsWith('\u00bf')) {\n                formattedSentence = '\u00bf' + formattedSentence;\n            }\n            if (!formattedSentence.endsWith('?')) {\n                formattedSentence += '?';\n            }\n    \n            return formattedSentence;\n        }\n    \n        function normalizeSentence(sentence) {\n            \/\/ Remove punctuation and convert to lowercase for comparison\n            return sentence.replace(\/[.,!?\u00bf\u00a1]\/g, '').toLowerCase().trim();\n        }\n    \n        function normalizeNumbers(text) {\n            \/\/ Map number words to digits\n            const numberWords = {\n                'cero': 0,\n                'uno': 1,\n                'una': 1,\n                'dos': 2,\n                'tres': 3,\n                'cuatro': 4,\n                'cinco': 5,\n                'seis': 6,\n                'siete': 7,\n                'ocho': 8,\n                'nueve': 9,\n                'diez': 10,\n                'once': 11,\n                'doce': 12,\n                'trece': 13,\n                'catorce': 14,\n                'quince': 15,\n                'diecis\u00e9is': 16,\n                'dieciseis': 16,\n                'diecisiete': 17,\n                'dieciocho': 18,\n                'diecinueve': 19,\n                'veinte': 20,\n                'veintiuno': 21,\n                'veintid\u00f3s': 22,\n                'veintidos': 22,\n                'veintitr\u00e9s': 23,\n                'veintitres': 23,\n                'veinticuatro': 24,\n                'veinticinco': 25,\n                'veintis\u00e9is': 26,\n                'veintiseis': 26,\n                'veintisiete': 27,\n                'veintiocho': 28,\n                'veintinueve': 29,\n                'treinta': 30,\n                'cuarenta': 40,\n                'cincuenta': 50,\n                'sesenta': 60,\n                'setenta': 70,\n                'ochenta': 80,\n                'noventa': 90,\n                'cien': 100\n            };\n    \n            \/\/ Regular expression to match numbers in words\n            const numberPattern = new RegExp('\\\\b(' + Object.keys(numberWords).join('|') + ')(\\\\s+y\\\\s+(' + Object.keys(numberWords).join('|') + '))?\\\\b', 'gi');\n    \n            text = text.replace(numberPattern, function(match) {\n                match = match.toLowerCase();\n                let parts = match.split(\/\\s+y\\s+\/);\n                let total = 0;\n                for (let part of parts) {\n                    part = part.trim();\n                    if (numberWords[part] !== undefined) {\n                        total += numberWords[part];\n                    }\n                }\n                return total.toString();\n            });\n    \n            return text;\n        }\n    \n        <\/script>\n    <\/body>\n    <\/html>\n","protected":false},"excerpt":{"rendered":"<p>Spanish Interaction &#8211; Family Vocabulary Sentences Yes\/No Questions WH Questions Internactions See the questions and answers in this box Spanish Interaction &#8211; Family Start Lesson Stop<\/p>\n","protected":false},"author":1,"featured_media":1344,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,34,33],"tags":[],"class_list":["post-1648","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-family","category-robots","category-spanish"],"featured_image_src":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2024\/06\/iPad-1024x585.webp","blog_images":{"medium":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2024\/06\/iPad-300x171.webp","large":"https:\/\/phamho.com\/book\/wp-content\/uploads\/2024\/06\/iPad-1024x585.webp"},"ams_acf":[],"_links":{"self":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1648","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=1648"}],"version-history":[{"count":3,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1648\/revisions"}],"predecessor-version":[{"id":1656,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/posts\/1648\/revisions\/1656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/media\/1344"}],"wp:attachment":[{"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/media?parent=1648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/categories?post=1648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phamho.com\/book\/wp-json\/wp\/v2\/tags?post=1648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}