Main

Dream Decoder body { font-family: “Times New Roman”, serif; margin: 20px; background-color: #ffe6ea; } .container { max-width: 600px; margin: auto; background: white; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } input, button, textarea { width: 100%; margin: 10px 0; padding: 8px; } .decoded-output, .word-list { margin-top: 20px; padding: 10px; background: #f8d7da; border-radius: 5px; } .question-area { margin-top: 20px; }

Dream Decoder

Add Words and Meanings

Add
Save Dictionary

Write a Dream Sentence

Interpret Dream
Save Decoded Dream
let wordMap = {}; let dreamElements = []; // List of stop words, pronouns, auxiliary verbs, adjectives describing form, and articles const stopWords = [ “he”, “she”, “it”, “they”, “him”, “her”, “his”, “hers”, “its”, “them”, “theirs”, “i”, “you”, “we”, “us”, “mine”, “our”, “ours”, “your”, “yours”, “and”, “but”, “so”, “to”, “is”, “are”, “was”, “were”, “be”, “been”, “being”, “have”, “has”, “had”, “having”, “take”, “make”, “get”, “come”, “go”, “do”, “does”, “did”, “doing”, “can”, “could”, “will”, “would”, “should”, “might”, “must”, “shall”, “ought”, “to”, “from”, “with”, “by”, “as”, “that”, “which”, “who”, “what”, “this”, “these”, “those”, “there”, “of”, “in”, “on”, “at”, “for”, “with”, “about”, “into”, “up”, “down”, “off”, “under”, “over”, “again”, “more”, “then”, “now”, “no”, “a”, “an”, “the”, “next”, “big”, “small”, “large”, “round”, “flat”, “long”, “short”, “tall”, “wide”, “narrow”, “heavy”, “light”, “thick”, “thin”, “thin”, “bright”, “dark”, “flat”, “clear”, “smooth”, “rough”, “hard”, “soft” ]; // Function to add words and their meanings to the dictionary function addWord() { let word = document.getElementById(“wordInput”).value.trim(); let meaning = document.getElementById(“meaningInput”).value.trim(); if (word && meaning) { wordMap[word.toLowerCase().replace(/[.,;:]/g, “”)] = meaning; document.getElementById(“wordInput”).value = “”; document.getElementById(“meaningInput”).value = “”; displayWords(); } } // Display the word dictionary function displayWords() { let wordListDiv = document.getElementById(“wordList”); wordListDiv.innerHTML = “Dream Dictionary:
” + Object.entries(wordMap) .map(([word, meaning]) => `${word}: ${meaning}`).join(“
“); } // Function to ask the user for interpretations of dream elements function askQuestions() { let dreamText = document.getElementById(“dreamInput”).value.trim(); if (!dreamText) { alert(“Please describe your dream first!”); return; } // Extract core words (nouns, verbs, adjectives) and ignore stop words let words = dreamText.split(/\s+/); dreamElements = []; words.forEach(word => { let cleanedWord = word.toLowerCase().replace(/[.,;:]/g, “”); if (!stopWords.includes(cleanedWord) && !dreamElements.includes(cleanedWord)) { dreamElements.push(cleanedWord); } }); if (dreamElements.length === 0) { alert(“No core words identified in your dream. Try adding more descriptive words.”); return; } let questionArea = document.getElementById(“questionArea”); questionArea.innerHTML = “

Personal Interpretations:

“; // Ask questions for each core word dreamElements.forEach((element, index) => { questionArea.innerHTML += ` What personal meaning does the word ${element} have for you?
`; }); questionArea.innerHTML += `Decode Dream`; } // Function to decode the dream using the user’s provided interpretations function decodeDream() { let decodedText = dreamElements.map((word, index) => { let meaningInput = document.getElementById(`meaningInput${index}`).value.trim(); // If no interpretation provided, keep the word intact return meaningInput || word; }).join(” “); document.getElementById(“decodedOutput”).innerText = decodedText; // Using the meanings to create a narrative for the dream createDreamMeaning(decodedText); } // Function to create a narrative interpretation of the dream based on personal meanings function createDreamMeaning(decodedText) { let dreamNarrative = “Your dream could be interpreted as follows:\n\n”; dreamElements.forEach((word, index) => { let interpretation = document.getElementById(`meaningInput${index}`).value.trim(); if (interpretation) { dreamNarrative += `The word “${word}” might symbolize: ${interpretation}\n`; } else { dreamNarrative += `The word “${word}” seems to represent something unknown or open to interpretation.\n`; } }); document.getElementById(“decodedOutput”).innerText = dreamNarrative; } // Save the dream dictionary function saveDictionary() { let dictionaryContent = JSON.stringify(wordMap, null, 2); let blob = new Blob([dictionaryContent], { type: “application/json” }); let a = document.createElement(“a”); a.href = URL.createObjectURL(blob); a.download = “dream_dictionary.json”; a.click(); } // Save the decoded dream function saveDecodedDream() { let decodedText = document.getElementById(“decodedOutput”).innerText; let blob = new Blob([decodedText], { type: “text/plain” }); let a = document.createElement(“a”); a.href = URL.createObjectURL(blob); a.download = “decoded_dream.txt”; a.click(); }