Q: Building a speech command i have this code and i get an error like this.
Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
training = np.array(training)
import threading
import speech_recognition

import pyttsx3 as tts
import tkinter as tk


from neuralintents import GenericAssistant


class Assistant:

    def __init__(self):
        self.recognizer=speech_recognition.Recognizer()
        self.speaker= tts.init()
        self.speaker.setProperty("rate",150)

        self.assistant=GenericAssistant("intent.json",intent_methods={"file": self.create_file})
        self.assistant.train_model()
    
        self.root=tk.Tk()
        self.label=tk.label(text="j",font=("Arial",120,"bold"))
        self.label.pack()

        threading.Thread(target=self.run_assistant).start()


        self.root.mainloop()

    def create_file(self):
       with open("somefile.text","w") as f:
            f.write("hellow")

    def run_assistant(self):
        while True:
            try:
                with speech_recognition.Microphone() as mic:
                    self.recognizer.adjust_for_ambient_noise(mic,duration=0.2)
                    audio = self.recognizer.listen(mic)

                    text= self.recognizer.recognize_google(audio)
                    text=text.lower()
                    if "hey" in text:
                        self.label.config(fg="red")
                        audio=self.recognizer.listen(mic)
                        text=self.recognizer.recogni(audio)
                        text=text.lower()

                        if text == "stop":
                            self.speaker.say("Good Bye")
                            self.speaker.runAndWait()
                            self.speaker.stop()
                            self.root.destroy()
                            sys.exit()

                        else:
                            if text is not None:
                                response= self.assistant.request(text)
                                if response is not None:
                                    self.speaker.say(response)
                                    self.speaker.runAndWait()
                            self.label.config(fg="black")
            except:
                self.label.config(fg="black")
                continue
Assistant()

