KyunKi Didi

KyunKi English

Your child's English questions, answered with warmth and clarity.

} } return matrix[b.length][a.length]; } function sendToSpeak() { if (!currentChild) return; showView('speak'); } function extractWordsForSpeak(text) { var words = (text.match(/\b[a-zA-Z]{4,}\b/g) || []).filter(function(w) { var common = ['this','that','with','from','they','have','were','said','each','which','their','would','there','could','other','after','first','these','very','when','what','know','want','been','call','come','made','find','give','than','them','well','then','also','more','some','time','than','only','just','over','into','your','year','good','much','back','even','here','look','down','most','long','last','work','life','still','own','under','right','old','any','same','tell','boy','girl','day','way','man','woman','little','about','again','around','before','because','through','between','without','another','something','someone','everyone','everything']; return common.indexOf(w.toLowerCase()) === -1; }); var unique = []; words.forEach(function(w) { if (unique.indexOf(w) === -1) unique.push(w); }); unique = unique.slice(0, 12); var container = document.getElementById('extracted-words'); if (!container) return; if (unique.length === 0) { container.innerHTML = 'Ask a question to see practice words here!'; return; } container.innerHTML = unique.map(function(w) { return '' + w + ''; }).join(''); } function setCustomWord(word) { document.getElementById('current-word').textContent = word; document.getElementById('current-phonetic').textContent = 'Tap \uD83D\uDD0A to hear'; hideFeedback(); document.querySelectorAll('#word-list .word-chip').forEach(function(c) { c.classList.remove('active'); }); } // ===================== HISTORY / JOURNEY ===================== function saveToHistory(question, data) { var history = JSON.parse(localStorage.getItem('kyunki_history') || '[]'); history.unshift({ question: question, parent: data.parent, child: data.child, encouragement: data.encouragement, style: data.style || userStyle, time: new Date().toISOString() }); if (history.length > 50) history.pop(); localStorage.setItem('kyunki_history', JSON.stringify(history)); } function renderHistory() { var history = JSON.parse(localStorage.getItem('kyunki_history') || '[]'); var container = document.getElementById('history-container'); if (history.length === 0) { container.innerHTML = '
📜

No questions yet.
Start asking Didi and your journey will appear here!

'; return; } var storiesCount = history.filter(function(h) { return h.style === 'stories'; }).length; var factsCount = history.filter(function(h) { return h.style === 'facts'; }).length; var topics = [...new Set(history.map(function(h) { return h.question.split(' ').slice(0,3).join(' '); }))].length; var html = '
' + '
' + history.length + '
Questions
' + '
' + topics + '
Topics
' + '
' + storiesCount + '
Stories
' + '
'; html += history.map(function(h, i) { var isStories = h.style === 'stories'; var date = new Date(h.time).toLocaleDateString(); var time = new Date(h.time).toLocaleTimeString([], {hour:'2-digit', minute:'2-digit'}); return '
' + '
' + escapeHtml(h.question) + '
' + '
' + '' + (isStories ? '\uD83D\uDCD6 Stories' : '\uD83C\uDFAF Facts') + '' + '' + date + ' \u00B7 ' + time + '' + '
' + '
' + '
For You:

' + escapeHtml(h.parent) + '

' + '
For Them:

' + escapeHtml(h.child) + '

' + (h.encouragement ? '
' + escapeHtml(h.encouragement) + '
' : '') + '
' + '
'; }).join(''); container.innerHTML = html; } function toggleHistoryDetail(index) { var el = document.getElementById('hist-detail-' + index); if (el) el.classList.toggle('open'); } // Init voices speechSynthesis.getVoices(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.onvoiceschanged = function() { speechSynthesis.getVoices(); }; } toLocaleDateString(); var time = new Date(h.time).toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'}); return '
'+ '
'+escapeHtml(h.question)+'
'+ '
'+ ''+(isStories?'\uD83D\uDCD6 Stories':'\uD83C\uDFAF Facts')+''+ ''+date+' \u00B7 '+time+''+ '
'+ '
'+ '
For You:

'+escapeHtml(h.parent)+'

'+ '
For Them:

'+escapeHtml(h.child)+'

'+ (h.encouragement?'
'+escapeHtml(h.encouragement)+'
':'')+ '
'+ '
'; }).join(''); container.innerHTML = html; } function toggleHistoryDetail(index) { var el = document.getElementById('hist-detail-'+index); if (el) el.classList.toggle('open'); } // Init voices speechSynthesis.getVoices(); if (speechSynthesis.onvoiceschanged !== undefined) { speechSynthesis.onvoiceschanged = function(){ speechSynthesis.getVoices(); }; }