<commit_before>#!/usr/bin/env python3
import speech_recognition as sr
import pyttsx3
import os
from plugin import plugin
import Jarvis
@plugin()
def hear(jarvis, s):
    r = sr.Recognizer()
    engine = pyttsx3.init()
    listen = False

    while listen is False:
        try:
            with sr.Microphone() as source:
                os.system("reset")
                print("Say listen to start listening")
                r.adjust_for_ambient_noise(source)
                audio = r.listen(source)
                pinger = r.recognize_google(audio)
            try:
                if (pinger.lower() == "listen"):
                    listen = True
                    print("Voice mode activated. Say something!")
                    break
                else:
                    continue
            except LookupError:
                continue
        except sr.UnknownValueError:
            continue

    while listen is True:
        print("Say somthing")
        try:
            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source)
                audio = r.listen(source)
                pinger = r.recognize_google(audio)

            if (pinger.lower() == "stop"):
                listen = False
                print("Listening stopped.")
                break
            else:
                print(pinger)
                if pinger[0:5] == "go to":
                    os.system("wmctrl -a " + pinger[7:])
                elif pinger[0:9] == "workspace":
                    pinger = pinger[11:len(pinger)]
                    if pinger == 'one':
                        pinger = 1
                    os.system("wmctrl -s " + str(int(pinger) - 1))
                else:
                    line = pinger
                    jarvis = Jarvis.Jarvis()
                    line = jarvis.precmd(line)<commit_msg>modified stt.py.<commit_after>#!/usr/bin/env python3
import speech_recognition as sr
import pyttsx3
import os
from plugin import plugin
@plugin()
def hear(jarvis, s):
    r = sr.Recognizer()
    engine = pyttsx3.init()
    listen = False

    while listen is False:
        try:
            with sr.Microphone() as source:
                os.system("reset")
                print("Say listen to start listening")
                r.adjust_for_ambient_noise(source)
                audio = r.listen(source)
                pinger = r.recognize_google(audio)
            try:
                if (pinger.lower() == "listen"):
                    listen = True
                    print("Voice mode activated. Say something!")
                    break
                else:
                    continue
            except LookupError:
                continue
        except sr.UnknownValueError:
            continue

    while listen is True:
        print("Say somthing")
        try:
            with sr.Microphone() as source:
                r.adjust_for_ambient_noise(source)
                audio = r.listen(source)
                pinger = r.recognize_google(audio).lower()

            if (pinger == "stop"):
                listen = False
                print("Listening stopped.")
                break
            else:
                print(pinger)
                if pinger[0:5] == "go to":
                    os.system("wmctrl -a " + pinger[7:])
                elif pinger[0:9] == "workspace":
                    pinger = pinger[11:len(pinger)]
                    if pinger == 'one':
                        pinger = 1
                    os.system("wmctrl -s " + str(int(pinger) - 1))
                elif pinger[0:4] == "open":
                    pinger = pinger[5:]
                    os.system("nohup " + pinger)
                else:
                    line = pinger
                    jarvis = jarvis._jarvis
                    line = jarvis.precmd(line)
{'fraction_non_alphanumeric': 0.09419724173822534, 'fraction_numerical': 0.00702576112412178, 'mean_word_length': 1.1965714285714286, 'pattern_counts': {'":': 5, '<': 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': '2098395', 'n_tokens_mistral': 1082, 'n_tokens_neox': 976, 'n_words': 245}