<commit_before>import re
import convert


def parse_query(query_str):
    avg_over_match = '^([0-9]*)(s|M|h|d|w|mo)$'
    query = {
        'patterns': [],
        'group_by': ['target_type=', 'unit=', 'server'],
        'sum_by': {},
        'avg_by': {},
        'avg_over': None,
        'min': None,
        'max': None
    }

    # for a call like ('foo bar baz quux', 'bar ', 'baz', 'def')
    # returns ('foo quux', 'baz') or the original query and the default val if no match
    def parse_out_value(query_str, predicate_match, value_match, value_default):
        match = re.search('(%s%s)' % (predicate_match, value_match), query_str)
        value = value_default<commit_msg>fix incorrect matching of things like 'octo foo' to mean 'to foo'<commit_after>import re
import convert


def parse_query(query_str):
    avg_over_match = '^([0-9]*)(s|M|h|d|w|mo)$'
    query = {
        'patterns': [],
        'group_by': ['target_type=', 'unit=', 'server'],
        'sum_by': {},
        'avg_by': {},
        'avg_over': None,
        'min': None,
        'max': None
    }

    # for a call like ('foo bar baz quux', 'bar ', 'baz', 'def')
    # returns ('foo quux', 'baz') or the original query and the default val if no match
    def parse_out_value(query_str, predicate_match, value_match, value_default):
        match = re.search('\\b(%s%s)' % (predicate_match, value_match), query_str)
        value = value_default
{'fraction_non_alphanumeric': 0.16678346180798878, 'fraction_numerical': 0.002803083391730904, 'mean_word_length': 2.966666666666667, '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': '6549247', 'n_tokens_mistral': 499, 'n_tokens_neox': 484, 'n_words': 130}