<commit_before>#!/usr/bin/python
import sys
import json

# Count average speeds for links

def main(locationdata_dictionary_file):

    locationdata = {}
    with open(locationdata_dictionary_file, "r") as dictionary_file:
        locationdata = json.load(dictionary_file)

    for input_line in sys.stdin:
        data = json.loads(input_line)

        for recognition in data['recognitions']:
            try:
                link_data = (item for item in locationdata['links'] if item['id'] == recognition['id']).next()
                average_speed  = (link_data['dist'] / recognition['tt']) * 3.6
                print "CountAverage: " + str(recognition['id']) + "\t" + str(int(average_speed))
            except:
                pass

if __name__ == "__main__":
    main(sys.argv[1])<commit_msg>Test average speed calculation by tracking sum and count separately<commit_after>#!/usr/bin/python
import sys
import json

# Count average speeds for links

def main(locationdata_dictionary_file):

    locationdata = {}
    with open(locationdata_dictionary_file, "r") as dictionary_file:
        locationdata = json.load(dictionary_file)

    for input_line in sys.stdin:
        data = json.loads(input_line)

        for recognition in data['recognitions']:
            try:
                link_data = (item for item in locationdata['links'] if item['id'] == recognition['id']).next()
                average_speed  = (link_data['dist'] / recognition['tt']) * 3.6
                print "LongValueSum:" + str(recognition['id']) + "_speedsum\t" + str(int(average_speed))
                print "LongValueSum:" + str(recognition['id']) + "_speedcount\t1"
            except:
                pass

if __name__ == "__main__":
    main(sys.argv[1])
{'fraction_non_alphanumeric': 0.12371134020618557, 'fraction_numerical': 0.004009163802978236, 'mean_word_length': 2.7813852813852815, 'pattern_counts': {'":': 2, '<': 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': '404271', 'n_tokens_mistral': 521, 'n_tokens_neox': 496, 'n_words': 122}