Artificial intelligence and machine learning

Question:

#/data/user/0/py03
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:
  pass 
  def __init__(self):
    pass 

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"bye","Goodbye!"
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):
   pass
 def 'neural_networks']
def.ai = '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):
  pass            
# Process user input here
  pass
def run(self):
  pass
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 )
try:
   user_input = r.recognize_google(audio)  
   print('User Input')
   self.process_input(user_input)
except:sr.UnknownValueError
print("Could not understan audio")
sr.RequestError 
print('could not request results',
      {0}. format(e))
if__name__ == '__main__'
elsie = ELSIE()
elsie.run()

Hello and welcome to Ask @DoricMwaipopo!

What do you need help with?

3 Likes

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?

2 Likes

@DoricMwaipopo I’ll fix your code:

#/data/user/0/py03
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!