<commit_before>var Tesseract = {}

Tesseract.recognize = function(image, options, callback){
	var lang = options.lang
	if(typeof lang === "undefined"){
		lang = 'eng'
	}

	if (typeof options === 'string') {
		lang = options
		options = {}
	}

	if (typeof options === "function") {
		callback = options
		options = {}
	}


	if(image.getContext){
		image = image.getContext('2d');
	}else if(image.tagName == "IMG" || image.tagName == "VIDEO"){
		var c = document.createElement('canvas');
		if(image.tagName == "IMG"){
			c.width  = image.naturalWidth;
			c.height = image.naturalHeight;
		}else if(image.tagName == "VIDEO"){
			c.width  = image.videoWidth;
			c.height = image.videoHeight;
		}
		var ctx = c.getContext('2d');
		ctx.drawImage(image, 0, 0);
		image = ctx;
	}
	if(image.getImageData) image = image.getImageData(0, 0, image.canvas.width, image.canvas.height);		


	var blob = new Blob(["\
		importScripts('https://raw.githubusercontent.com/naptha/tesseract.js/master/lib/Tesseract.js');\
	};"]);

	var worker = new Worker(window.URL.createObjectURL(blob));
	
	worker.onmessage = function(e){
	    alert(e.data == 'object' && 'Woot! your browser supports cross domain importScripts')
	}
	worker.postMessage(42)
	var worker = new Worker('/lib/worker.js')

	var progress = (function(){
		if(typeof options.progress === 'function'){
			var p = options.progress
			delete options.progress
			return p
		}
		return function(){}
	})()


	if(typeof callback === "function"){
		worker.onmessage = function(e){
			if(e.data.progress){
				progress(e.data.progress)
			}
			else{
				callback(e.data.err, e.data.result)
			}<commit_msg>I like turtles<commit_after>var Tesseract = {}

Tesseract.recognize = function(image, options, callback){
	var lang = options.lang
	if(typeof lang === "undefined"){
		lang = 'eng'
	}

	if (typeof options === 'string') {
		lang = options
		options = {}
	}

	if (typeof options === "function") {
		callback = options
		options = {}
	}


	if(image.getContext){
		image = image.getContext('2d');
	}else if(image.tagName == "IMG" || image.tagName == "VIDEO"){
		var c = document.createElement('canvas');
		if(image.tagName == "IMG"){
			c.width  = image.naturalWidth;
			c.height = image.naturalHeight;
		}else if(image.tagName == "VIDEO"){
			c.width  = image.videoWidth;
			c.height = image.videoHeight;
		}
		var ctx = c.getContext('2d');
		ctx.drawImage(image, 0, 0);
		image = ctx;
	}
	if(image.getImageData) image = image.getImageData(0, 0, image.canvas.width, image.canvas.height);		


	var blob = new Blob(["importScripts('https://cdn.rawgit.com/naptha/tesseract.js/master/worker/worker.js');"]);

	var worker = new Worker(window.URL.createObjectURL(blob));

	var progress = (function(){
		if(typeof options.progress === 'function'){
			var p = options.progress
			delete options.progress
			return p
		}
		return function(){}
	})()


	if(typeof callback === "function"){
		worker.onmessage = function(e){
			if(e.data.progress){
				progress(e.data.progress)
			}
			else{
				callback(e.data.err, e.data.result)
			}
{'fraction_non_alphanumeric': 0.16977428851815504, 'fraction_numerical': 0.004579653254824992, 'mean_word_length': 3.7191358024691357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1726966', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1061, 'n_words': 217}