<commit_before><commit_msg>Add script to convert JSON arrays to newline separated JSON<commit_after>#!/usr/bin/env python
import json
import sys

def newline_json(in_file, out_file):
    for line in json.load(in_file):
        json.dump(line, out_file)
        out_file.write('\n')

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print "Usage: python newlinejson.py [path to ordinary json file]"
        sys.exit(1)

    f = open(sys.argv[1], 'r')
    try:
        newline_json(f, sys.stdout)
    finally:
        f.close()
{'fraction_non_alphanumeric': 0.12290502793296089, 'fraction_numerical': 0.00558659217877095, 'mean_word_length': 2.9558823529411766, 'pattern_counts': {'":': 0, '<': 4, '<?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': '3857756', 'n_tokens_mistral': 188, 'n_tokens_neox': 185, 'n_words': 49}