<commit_before>import os
import wave
import yaml
import speech_recognition as sr

try:
    from pocketsphinx.pocketsphinx import *
    from sphinxbase.sphinxbase import *
except:
    pass

from brain import brain
from GreyMatter.SenseCells.tts import tts

def main():
    profile = open('profile.yaml')
    profile_data = yaml.safe_load(profile)
    profile.close()

    r = sr.Recognizer()

    tts('Welcome ' + profile_data['name'] + ', systems are now ready to run. How can I help you?')

    if profile_data['stt'] == 'google':
        while True:
            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source)
                print("Say something!")
                audio = r.listen(source)

            try:
                speech_text = r.recognize_google(audio).lower().replace("'", "")
                print("Melissa thinks you said '" + speech_text + "'")
            except sr.UnknownValueError:
                print("Melissa could not understand audio")
            except sr.RequestError as e:
                print("Could not request results from Google Speech Recognition service; {0}".format(e))
            else:
                brain(profile_data, speech_text)

    elif profile_data['stt'] == 'sphinx':

        def sphinx_stt():
            modeldir = profile_data['pocketsphinx']['modeldir']
            hmm = profile_data['pocketsphinx']['hmm']
            lm = profile_data['pocketsphinx']['lm']
            dic = profile_data['pocketsphinx']['dic']<commit_msg>Add check for profile.yaml<commit_after>import os
import wave
import yaml
import speech_recognition as sr

try:
    from pocketsphinx.pocketsphinx import *
    from sphinxbase.sphinxbase import *
except:
    pass

from brain import brain
from GreyMatter.SenseCells.tts import tts

def main():
    if os.path.isfile('profile.yaml'):
        profile = open('profile.yaml')
        profile_data = yaml.safe_load(profile)
        profile.close()
    else:
        print('profile.yaml not found')
        exit()

    r = sr.Recognizer()

    tts('Welcome ' + profile_data['name'] + ', systems are now ready to run. How can I help you?')

    if profile_data['stt'] == 'google':
        while True:
            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source)
                print("Say something!")
                audio = r.listen(source)

            try:
                speech_text = r.recognize_google(audio).lower().replace("'", "")
                print("Melissa thinks you said '" + speech_text + "'")
            except sr.UnknownValueError:
                print("Melissa could not understand audio")
            except sr.RequestError as e:
                print("Could not request results from Google Speech Recognition service; {0}".format(e))
            else:
                brain(profile_data, speech_text)

    elif profile_data['stt'] == 'sphinx':

        def sphinx_stt():
            modeldir = profile_data['pocketsphinx']['modeldir']
            hmm = profile_data['pocketsphinx']['hmm']
            lm = profile_data['pocketsphinx']['lm']
            dic = profile_data['pocketsphinx']['dic']
{'fraction_non_alphanumeric': 0.11223521972810623, 'fraction_numerical': 0.0006323110970597534, 'mean_word_length': 2.3375527426160336, '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': '2777424', 'n_tokens_mistral': 944, 'n_tokens_neox': 875, 'n_words': 225}