<commit_before>import rigor.runner
import rigor.imageops
from rigor.database import Database
from rigor.dbmapper import DatabaseMapper

import argparse
import Image, ImageDraw

parameters = {
	"pyramid_step": 2,
	"pyramid_substep": 1.25,
	"pyramid_num_substeps": 5,
	"pyramid_min_width": 20,
	"pyramid_min_height": 10,
	"pyramid_window_width": 20,
	"pyramid_window_height": 10,
	"cluster_min_area": 600,
	"cluster_min_weight": 1.0
}

def main():
	parser = argparse.ArgumentParser(description='Runs text detector on relevant images')
	parser.add_argument('classifier_file', help='Path to classifier CLF')
	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()
	parameters["classifier_file"] = args.classifier_file
	i = rigor.runner.Runner('text', parameters, args.limit, args.random)
	database_mapper = DatabaseMapper(Database())
	for result in i.run():
		detected = result[1]
		expected = result[2]
		image = database_mapper.get_image_by_id(result[0])
		pil_image = Image.open(rigor.imageops.fetch(image))<commit_msg>int data type for limit here, too<commit_after>import rigor.runner
import rigor.imageops
from rigor.database import Database
from rigor.dbmapper import DatabaseMapper

import argparse
import Image, ImageDraw

parameters = {
	"pyramid_step": 2,
	"pyramid_substep": 1.25,
	"pyramid_num_substeps": 5,
	"pyramid_min_width": 20,
	"pyramid_min_height": 10,
	"pyramid_window_width": 20,
	"pyramid_window_height": 10,
	"cluster_min_area": 600,
	"cluster_min_weight": 1.0
}

def main():
	parser = argparse.ArgumentParser(description='Runs text detector on relevant images')
	parser.add_argument('classifier_file', help='Path to classifier CLF')
	parser.add_argument('-l', '--limit', type=int, 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()
	parameters["classifier_file"] = args.classifier_file
	i = rigor.runner.Runner('text', parameters, args.limit, args.random)
	database_mapper = DatabaseMapper(Database())
	for result in i.run():
		detected = result[1]
		expected = result[2]
		image = database_mapper.get_image_by_id(result[0])
		pil_image = Image.open(rigor.imageops.fetch(image))
{'fraction_non_alphanumeric': 0.1293512658227848, 'fraction_numerical': 0.01661392405063291, 'mean_word_length': 6.57185628742515, 'pattern_counts': {'":': 18, '<': 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': '2109057', 'n_tokens_mistral': 896, 'n_tokens_neox': 851, 'n_words': 198}