pythonartificial-intelligenceassistant

How do i make my assistant active by a certain phrase


I have made a python personal assistant. But every time I want to use it I have to open command prompt and run it. And if I give it a command after executing it, it still keeps listening and if close it then I have to run it in command prompt again the next time. Is there a way I can add it into windows and it becomes active when I say a certain phrase and stops after a certain duration of silence.


Solution

  • I got your question, first of all how it takes your input by-voice or text?

    If it takes voice input you can make a thread that runs continuously in background and listens to your voice. Decide a phrase(like hey Siri). Use a while input to continuously analyze sentences. Use if-else statement to make sure if the phrase that you've decided is included in input sentence. Make it decide whether user have called it or not. Else if user have not called it just keep listening. I've made one assistant my self in java:

    while (true) {    
        String input = takeInput(); //Create a function to take input.
        if (//input contains 'Hey Siri') {
            //do some code here
        } else {continue;}
    }