<commit_before>import functools

def _hash(word):
    return functools.reduce(lambda x,y: x + y, sorted([c for c in word]))

def is_anagram(w1, w2):
    return _hash(w1) == _hash(w2)

def collect_anagrams(words):
    anagrams = {}
    for w in words:
        key = _hash(w)
        if key not in anagrams:
            anagrams[key] = []

        anagrams[key].append(w)

    return anagrams.values()<commit_msg>Ugly but more pythonic?<commit_after>def _hash(word):
    return "".join(sorted(word))

def is_anagram(w1, w2):
    return _hash(w1) == _hash(w2)

def collect_anagrams(words):
    anagrams = {}
    for w in words:
        key = _hash(w)
        if key not in anagrams:
            anagrams[key] = []

        anagrams[key].append(w)

    return anagrams.values()
{'fraction_non_alphanumeric': 0.12807244501940493, 'fraction_numerical': 0.01034928848641656, 'mean_word_length': 2.7211538461538463, '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': '4965070', 'n_tokens_mistral': 293, 'n_tokens_neox': 289, 'n_words': 68}