<commit_before>#!/usr/bin/python3

import sys
import json
import random

#{
#    "1": [100, 200, 300, "url", ["tag1 tag2"]"],
#    "2": [200, 100, 300, "url", ["tag1 tag2"]]
#}



def main(argv):
    if len(argv) != 3:
        print("Generates json like this:")
        print("\"1\": [100, 200, 300, \"url\", [\"tag1 tag2\"]\"]")
        sys.exit("Usage: ./generate.py Elements OutputFile")
    data = generate(argv[1])
    write_file(data, argv[2])


def generate(elements):
    data = []
    genders = ['male', 'female']
    for i in range(1, int(elements) + 1):
        x = random.randint(50, 800)
        y = random.randint(50, 800)
        z = random.randint(50, 800)
        age_tag = random.randint(1,111)
        gender_tag = genders[random.randint(0,len(genders)-1)] 
        item = {str(i): [x, y, z, "url", [gender_tag + " " + str(age_tag)]]}
        data.append(item)

    return data


def write_file(data, filename):
    with open(filename, 'w') as outfile:
        json.dump(data, outfile)
<commit_msg>generator fixes<commit_after>#!/usr/bin/python3

import sys
import json
import random

#{
#    "1": [100, 200, 300, "url", ["tag1 tag2"]"],
#    "2": [200, 100, 300, "url", ["tag1 tag2"]]
#}



def main(argv):
    if len(argv) != 3:
        print("Generates json like this:")
        print('"1": [100, 200, 300, "url", ["tag1", "tag2]"]')
        sys.exit("Usage: ./generate.py Elements OutputFile")
    data = generate(argv[1])
    write_file(data, argv[2])


def generate(elements):
    data = []
    genders = ['male', 'female']
    for i in range(1, int(elements) + 1):
        x = random.randint(50, 800)
        y = random.randint(50, 800)
        z = random.randint(50, 800)
        age_tag = random.randint(1,111)
        gender_tag = genders[random.randint(0,len(genders)-1)] 
        item = {str(i): [x, y, z, "url", [gender_tag, str(age_tag)]]}
        data.append(item)

    return data


def write_file(data, filename):
    with open(filename, 'w') as outfile:
        json.dump(data, outfile)

{'fraction_non_alphanumeric': 0.18873517786561264, 'fraction_numerical': 0.06225296442687747, 'mean_word_length': 2.8135593220338984, 'pattern_counts': {'":': 6, '<': 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': '3902335', 'n_tokens_mistral': 841, 'n_tokens_neox': 741, 'n_words': 183}