<commit_before>import re
import yaml
import importlib
import string

english = 'abcdefghijklmnopqrstuvwxyz'
russian = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'

sorries = {
    'en': "Sorry, I don't understand you :(",
    'ru': "Извини, я тебя не понимаю :("
}


def process_text(query):
    if query[0] in english:
        lang = 'en'
    elif query[0] in russian:
        lang = 'ru'
    else:
        lang = 'en'
    try:
        file = yaml.load(open('bot/queries/{}.yml'.format(lang), encoding='utf-8'))
    except FileNotFoundError:
        file = yaml.load(open('{}.yml'.format(lang), encoding='utf-8'))
    query = query.lower()
    for source, regexes in file.items():
        for regex in regexes:
            if not regex['eval']:
                ex = ''.join([x for x in query if x not in string.punctuation])
            else:
                ex = query
            if re.match(regex['regex'], ex):
                lib = importlib.import_module('bot.queries.providers.{}'.format(source))
                request = re.search(regex['regex'], ex).group(regex['query'])
                res = lib.get(request, lang)
                splitted = res.split('\n')
                if splitted[0] == 'nan':
                    return regex['error'].format(request) + (splitted[1] if len(splitted) > 1 else '')
                return res
    return sorries[lang]<commit_msg>Fix letter case sensetive commands<commit_after>import re
import yaml
import importlib
import string

english = 'abcdefghijklmnopqrstuvwxyz'
russian = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'

sorries = {
    'en': "Sorry, I don't understand you :(",
    'ru': "Извини, я тебя не понимаю :("
}


def process_text(query):
    if query[0] in english:
        lang = 'en'
    elif query[0] in russian:
        lang = 'ru'
    else:
        lang = 'en'
    try:
        file = yaml.load(open('bot/queries/{}.yml'.format(lang), encoding='utf-8'))
    except FileNotFoundError:
        file = yaml.load(open('{}.yml'.format(lang), encoding='utf-8'))
    for source, regexes in file.items():
        for regex in regexes:
            if not regex['eval']:
                ex = ''.join([x for x in query.lower() if x not in string.punctuation])
            else:
                ex = query.lower()
            if re.match(regex['regex'], ex):
                lib = importlib.import_module('bot.queries.providers.{}'.format(source))
                request = re.search(regex['regex'], ex).group(regex['query'])
                res = lib.get(request, lang)
                splitted = res.split('\n')
                if splitted[0] == 'nan':
                    return regex['error'].format(request) + (splitted[1] if len(splitted) > 1 else '')
                return res
    return sorries[lang]
{'fraction_non_alphanumeric': 0.14186977082575483, 'fraction_numerical': 0.005092761004001455, 'mean_word_length': 2.20139697322468, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6403459', 'n_tokens_mistral': 918, 'n_tokens_neox': 887, 'n_words': 213}