<commit_before>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import re
def input_general(text):
    if not text.endswith(' '):
        text += ' '
    try:
        feedback = input(text)
    except:
        feedback = None
    return feedback
def input_float(text):
    while True:
        feedback = input_general(text)
        if feedback == '':
            feedback = '0.0'
        if feedback == None:
            break
        if feedback.find(',') != -1 and feedback.find('.') != -1:
            # assume , for decimal
            feedback = feedback.replace('.', '')
        if feedback.find(',') != -1:
            feedback = feedback.replace(',', '.')
        try:
            feedback = float(feedback)
        except:
            print('I did not understand, please input a float')
        else:
            break
    return feedback

def input_string(text, regex, default=''):
    while True:
        if default != '':
            text = text + ' [' + default + ']' 
        feedback = input_general(text)
        if feedback == None:
            break
        if feedback == '' and default != '':
            feedback = default
            break
        if not re.match(regex, feedback):
            print('Your input must match', regex)
        else:
            break
    return feedback<commit_msg>extend input methods<commit_after>#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import re
def input_general(text):
    if not text.endswith(' '):
        text += ' '
    try:
        feedback = input(text)
    except:
        feedback = None
    return feedback
def input_float(text):
    while True:
        feedback = input_general(text)
        if feedback == '':
            feedback = '0.0'
        if feedback == None:
            break
        if feedback.find(',') != -1 and feedback.find('.') != -1:
            # assume , for decimal
            feedback = feedback.replace('.', '')
        if feedback.find(',') != -1:
            feedback = feedback.replace(',', '.')
        try:
            feedback = float(feedback)
        except:
            print('I did not understand, please input a float')
        else:
            break
    return feedback

def input_string(text, regex, default=''):
    while True:
        if default != '':
            text = text + ' [' + default + ']' 
        feedback = input_general(text)
        if feedback == None:
            break
        if feedback == '' and default != '':
            feedback = default
            break
        if not re.match(regex, feedback, re.IGNORECASE):
            print('Your input must match', regex)
        else:
            break
    return feedback

def input_yes(text, default='no'):
    feedback = input_string(text, 'yes|no', default=default)
    if feedback.lower() == 'yes':
        return True
    else:
        return False
{'fraction_non_alphanumeric': 0.12870239774330042, 'fraction_numerical': 0.004936530324400564, 'mean_word_length': 1.6814744801512287, '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': '4495831', 'n_tokens_mistral': 767, 'n_tokens_neox': 760, 'n_words': 223}