I am trying to make my discord bot respond to more than one person at a time. One of my functions interacts with the spacy module and process big chunks of text. If the function is called once, and once again it ultimately ends up freezing up my bot because it is trying to process the first request.
nlp = spacy.load("en_core_web_sm")
@bot.event
async def on_message(message):
if message.content.startswith('!research'):
doc = 'long paragraphs...'
#Searches through doc for sentences relating to a word
nlp(doc) #Takes time to process here
results = textacy.extract.semistructured_statements(document, 'a word')
My question: How can I run a similar function with multiple request at the same time or what am I doing wrong here?