<commit_before>from ..queues import QueueCommand, QueueInput
from ..components import _BaseComponent

# Sub components imports :
#   -Speech To Text engine
from .STT_Engine import STT_Engine


class SpeechToText(_BaseComponent):

    def __init__(self):
        super().__init__()
        self.queue_command = QueueCommand()
        self.queue_input = QueueInput()
        self.stt = STT_Engine()

    def run(self):
        while self.queue_input.empty():
            pass
        audio_stream = self.queue_input.get()
        print ("Sending information to be translated...")
        result = self.stt.recognize(audio_stream)
        print ("Message received...")
        if result["results"][0]["alternatives"][0]["transcript"] :
            self.queue_command.put(result["results"][0]["alternatives"][0]["transcript"])
            self.queue_input.task_done()<commit_msg>don't actively wait on the queue for commands queue.GET IS ALREADY DOING THAT<commit_after>from ..queues import QueueCommand, QueueInput
from ..components import _BaseComponent

# Sub components imports :
#   -Speech To Text engine
from .STT_Engine import STT_Engine


class SpeechToText(_BaseComponent):

    def __init__(self):
        super().__init__()
        self.queue_command = QueueCommand()
        self.queue_input = QueueInput()
        self.stt = STT_Engine()

    def run(self):
        audio_stream = self.queue_input.get()
        print ("Sending information to be translated...")
        result = self.stt.recognize(audio_stream)
        print ("Message received...")
        if result["results"][0]["alternatives"][0]["transcript"] :
            self.queue_command.put(result["results"][0]["alternatives"][0]["transcript"])
            self.queue_input.task_done()
{'fraction_non_alphanumeric': 0.12236767216846899, 'fraction_numerical': 0.004553215708594195, 'mean_word_length': 3.136470588235294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5500343', 'n_tokens_mistral': 516, 'n_tokens_neox': 502, 'n_words': 114}