pythonmachine-learningpyttsx3

how to combine 2 functions in one phrase machine learning sklearn


I have a data_set that stores the assistant's answers to my questions/tasks

data_set = {  'whats new':'passive Is nothing special...',  '':'', }

passive - a stub in a simple dialog with a bot.

can an assistant perform 2 functions at once? for example, the functions of opening the browser and the game.

that is, I want it to look something like this:

data_set = {  'whats new':'game browser Is nothing special...',  '':'', }

def game():
    pass
def browser():
    pass

I expect my assistant to perform 2 functions at once in one phrase


Solution

  • I'm a beginner too. My first instinct was to suggest a pipeline, but if you need to run two functions concurrently, maybe you need a parallel processing tool like joblib?

    from joblib import Parallel, delayed
    res = Parallel(n_jobs=2)(delayed(f)() for f in [game, browser])
    

    You could also try your luck with the concurrent module.