Your first block
Plant Companion
<br/> body {<br/> font-family: Arial, sans-serif;<br/> background-color: #f0f8ff;<br/> text-align: center;<br/> padding: 20px;<br/> }<br/> #conversation {<br/> border: 2px solid #4CAF50;<br/> padding: 20px;<br/> margin: 20px auto;<br/> width: 80%;<br/> max-width: 500px;<br/> background-color: #ffffff;<br/> border-radius: 10px;<br/> box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);<br/> }<br/> #response {<br/> font-weight: bold;<br/> color: #4CAF50;<br/> }<br/> button {<br/> padding: 10px 20px;<br/> background-color: #4CAF50;<br/> color: white;<br/> border: none;<br/> border-radius: 5px;<br/> cursor: pointer;<br/> }<br/> button:hover {<br/> background-color: #45a049;<br/> }<br/>
Talk to Your Plant Companion
You: (waiting for input...)
Detected Emotion: (none yet)
Plant: (waiting to respond...)
of text...
Talk
<br/> const responses = {<br/> "stress": "I'm sorry to hear that. Even the strongest tree bends in the wind but doesn’t break. Let's breathe together... Inhale... and exhale slowly.",<br/> "depression": "I’m here for you. Remember, even in the darkest nights, the stars still shine.",<br/> "calm": "I'm feeling hydrated and happy, thanks for asking! How about you?",<br/> "default": "I'm here for you. Can you tell me more about how you're feeling?"<br/> };</p><p> const startListening = () => {<br/> const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();<br/> recognition.lang = 'en-US';</p><p> recognition.onstart = () => {<br/> document.getElementById('response').innerText = "Listening...";<br/> };</p><p> recognition.onresult = (event) => {<br/> const userInput = event.results[0][0].transcript.toLowerCase();<br/> document.getElementById('user-input').innerText = `You: ${userInput}`;<br/> <br/> // Analyze emotion based on speech patterns<br/> const emotion = detectEmotion(event.results[0][0]);<br/> document.getElementById('emotion').innerText = `Detected Emotion: ${emotion}`;</p><p> // Get response based on emotion<br/> const response = responses[emotion] || responses["default"];<br/> document.getElementById('response').innerText = `Plant: ${response}`;<br/> <br/> // Speak the plant's response<br/> const utterance = new SpeechSynthesisUtterance(response);<br/> speechSynthesis.speak(utterance);<br/> };</p><p> recognition.onerror = (event) => {<br/> document.getElementById('response').innerText = "Error occurred: " + event.error;<br/> };</p><p> recognition.start();<br/> };</p><p> const detectEmotion = (speechResult) => {<br/> const { confidence } = speechResult;<br/> const { transcript } = speechResult;</p><p> // Mock detection based on length and word count<br/> const wordCount = transcript.split(" ").length;<br/> if (wordCount < 5) {<br/> return "depression"; // Few words indicate possible depression<br/> } else if (confidence > 0.85 && wordCount > 10) {<br/> return "stress"; // Long, confident speech indicates stress<br/> } else {<br/> return "calm"; // Default to calm<br/> }<br/> };<br/>
Your second block of text...
RELIEF FROM, PAIN, STRESS AND DISEASE NATURALLY
Ulverston Natural Health Centre
1,Trinity Hall, The Gill, Ulverston, Cumbria, LA12 7BJ
call 01229 586959
E-mail: sheilacreativespace@gmail.com