<commit_before>import rigor.runner

import argparse

def main():
	parser = argparse.ArgumentParser(description='Runs algorithm on relevant images')
	parser.add_argument('domain', help='Domain to run')
	parser.add_argument('parameters', help='Path to parameters file')
	parser.add_argument('-l', '--limit', metavar='COUNT', required=False, help='Maximum number of images to use')
	parser.add_argument('-r', '--random', action="store_true", default=False, required=False, help='Fetch images ordered randomly if limit is active')
	args = parser.parse_args()
	i = rigor.runner.Runner(args.domain, args.parameters, args.limit, args.random)
	for result in i.run():
		print("\t".join([str(x) for x in result]))

if __name__ == '__main__':
	main()
<commit_msg>Added support for json parameters on command line<commit_after>import rigor.runner

import argparse
import json

def main():
	parser = argparse.ArgumentParser(description='Runs algorithm on relevant images')
	parser.add_argument('domain', help='Domain to run')
	parser.add_argument('parameters', help='Path to parameters file, or JSON block containing parameters')
	parser.add_argument('-l', '--limit', metavar='COUNT', required=False, help='Maximum number of images to use')
	parser.add_argument('-r', '--random', action="store_true", default=False, required=False, help='Fetch images ordered randomly if limit is active')
	args = parser.parse_args()
	try:
		parameters = json.loads(args.parameters)
	except ValueError:
		parameters = args.parameters
	i = rigor.runner.Runner(args.domain, parameters, args.limit, args.random)
	for result in i.run():
		print("\t".join([str(x) for x in result]))

if __name__ == '__main__':
	main()

{'fraction_non_alphanumeric': 0.14192399049881235, 'fraction_numerical': 0.0, 'mean_word_length': 6.020833333333333, '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': '5471479', 'n_tokens_mistral': 507, 'n_tokens_neox': 502, 'n_words': 149}