<commit_before>import sys

from collections import defaultdict

counter = defaultdict(int)
cut = 10

with open(sys.argv[1]) as f:
    for line in f:
        for word in line.split():
            counter[word] += 1


from operator import itemgetter

for word,count in sorted( counter.iteritems(), key=itemgetter(1), reverse=True ):
    if count > cut:
        print word, count

<commit_msg>Clean Python code and make it compatible with both python2 and python3<commit_after>from __future__ import print_function
import sys
from collections import Counter
from operator import itemgetter


def main():
    cut = 10
    counter = Counter()
    with open(sys.argv[1], 'r') as f:
        for line in f:
            for word in line.split():
                counter[word] += 1

    for word, count in sorted(counter.items(), key=itemgetter(1), reverse=True):
        if count > cut:
            print(word, count)


if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.09599156118143459, 'fraction_numerical': 0.012658227848101266, 'mean_word_length': 2.905349794238683, 'pattern_counts': {'":': 1, '<': 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': '6041002', 'n_tokens_mistral': 287, 'n_tokens_neox': 274, 'n_words': 103}