Harpyia/src/message/prompt_service.py
Sviatoslav Tsariov e89122cb76 Implemented new architecture
Created message service responsible for searching the prompts inside the recognized text and sending it to the client.

Created recognizer with two strategies: whisper and Dany's fast whisper.

Implemented file stack which works in the separated thread, sends the file to the recognizer and after that sends the message to the client (Rat, for example).
2024-03-19 19:01:36 +03:00

17 lines
392 B
Python

class PromptService:
def __init__(self, prompt):
self._prompt = prompt
def has_prompt(self, text: str) -> bool:
for part in text.split(' '):
return part in self._prompt.split(' ')
def filter_words_with_prompt(self, text: str) -> str:
words = []
for part in text.split(' '):
if part in self._prompt.split(' '):
words.append(part)
return words