Artificial intelligence and machine learning


import pyttsx3 
import speech_recognition as sr
import numpy as np
import tensorflow as tf
import nltk
import sys
import pandas as pd

class ELSIE:
  def __init__(self):

parttens ='['
  # r"hello/hi/hey":"hello!",
r"how are you","lam fine thank for asking!"
r"what is your name","my name is ELSIE!"
r"thank you","you are welcome!"
r"(.*)","lam sorry,l dont understand!"

#function to generate ELSIE response based on user inputs 
def generate_response(user_input):
 def 'neural_networks'] = 'advanced'
def.emotional_support = True
def.problem_solving = True 
def.self_adaptation = True
def.instructor = True 
def.framework = True 
def.pyaudio = True
def.natural_language = True
def.system_bypass = True
def. intelligence = 'very intelligent'
def.strings = 'better'
def.modules = 'best'
def.data_structures = 'best'
def.algorithms ='best'
def.mathematical_calculations = 'best'
def.mechanical_engineering_data ='best'
def.learning = 'advanced'
def.rocket_science_data = True 
def.personal_assistant = True 
def.fast_processing = True 
def.adviser = True 

def process_input(user_input):
# Process user input here
def run(self):
engine = pyttsx3.init()
engine.setProperty('voice',     self.voice)
r = sr.Recognizer()
while True:
  with sr.Microphone(): 
   print ('listening...')
   audio = r.listen(source )
r.listen(source )
   user_input = r.recognize_google(audio)  
   print('User Input')
print("Could not understan audio")
print('could not request results',
      {0}. format(e))
if__name__ == '__main__'
elsie = ELSIE()

Hello and welcome to Ask @DoricMwaipopo!

What do you need help with?


he may be just showing his code

1 Like

He probably isn’t. It has a whole lot of errors in it.
Looks like OP doesn’t even know how to code in Python

@DoricMwaipopo AI is supposed to train itself, if you have some patterns list then it’s basically a chatbot, not AI.
And who taught you r"" is regex? It actually means raw.
And you don’t need an extra pass in your class.
And def is a keyword, and cannot have attributes.

The provided code appears to be an incomplete Python script for a virtual assistant named “ELSIE.” It includes the import statements for various libraries like pyttsx3, speech_recognition, numpy, tensorflow, and pandas. However, the script contains placeholders in several places, and there are some syntax errors and incomplete definitions.

A bit unsure why there are so many functions just filled up with pass, not to mention the ELSIE class will be completely broken because of the random pass inside of it too.

Is there anything you may need help with @DoricMwaipopo, such as solving errors and/or receiving feedback?


@DoricMwaipopo I’ll fix your code:

import pyttsx3 
import speech_recognition as sr
import numpy as np
import tensorflow as tf
import nltk
import sys
import pandas as pd

Done! :slight_smile:

It looks like you’ve shared some Python code related to a class named “ELISE” and a collection of patterns for speech recognition. If you have any specific questions or need assistance with this code, please let me know, and I’ll be happy to help!