<commit_before>var classRect = (function() {
    var classRect = function(x, y, w, h, title, canvas) {
        if (x != null && y != null) {
            this.site = {
                'x': x,
                'y': y
            };
        } else {
            this.site = {
                'x': 0,
                'y': 0
            };
        }
        this.title = title;
        this.size = {
            'w': w,
            'h': h
        };
        this.canvas = document.getElementById(canvas);
    };
    classRect.prototype.draw = function(r, g, b) {
        var ctx = this.canvas.getContext('2d');
        if (r != null && g != null && b != null)
            ctx.fillStyle = "rgb(" + r + "," + g + "," + b + ")"; //設定圖形顏色（Red, Green, Blue）
        else
            ctx.fillStyle = "rgb(200,0,0)";
        ctx.fillRect(this.site.x, this.site.y, this.size.w, this.size.h); //設定位置（x, y, width, height）
        ctx.font = "5px Arial";
        ctx.fillStyle = "rgb(0,0,0)";
        ctx.fillText(this.title, this.site.x, this.site.y);
    };
    classRect.prototype.clearAll = function() {

        this.canvas.width = this.canvas.width;
    };
    classRect.prototype.delete = function() {
        var ctx = this.canvas.getContext('2d');
        ctx.clearRect(this.site.x - 1, this.site.y - 1, this.size.w + 1, this.size.h + 1);
    };

    return classRect;
})();

var classLine = (function() {

    var classLine = function(x, y, canvas) {
        this.node = [];
        this.head = {
            'x': x,
            'y': y
        };
        this.canvas = canvas;
    };
    classLine.prototype.addNode = function(x, y) {
        this.node.push({
            'x': x,
            'y': y
        });
    };
    classLine.prototype.draw = function() {
        var ctx = this.canvas.getContext('2d');
        ctx.moveTo(this.head.x, this.head.y);
        console.log(this.head.x + "" + this.head.y);
        for (var n = 0; n < this.node.length; n++) {
            ctx.lineTo(this.node[n].x, this.node[n].y);
            console.log(this.node[n].x + "" + this.node[n].y);
            ctx.stroke();
            ctx.moveTo(this.node[n].x, this.node[n].y);
        }

    };

    return classLine;
})();




var skillTree = (function() {
    var skillTree = function(sourec) {
        this.classArray = [];
        this.classNumArray = [];
        this.rectArray = [];
        this.lineArray = [];
        for (var a in json._1) {
        	this.classNumArray.push(a);
        	this.classArray.push(eval("json._1." + a ) );
        }
        for(var i=0,x=0;i<this.classArray.length;i++,x+=18){
        	this.addNode(x,20,15,15,this.classNumArray[i],"tab1");
        }
    }
    skillTree.prototype.addNode = function(x, y, w, h, title, canvas) {
    	var newNode = new classRect(x, y, w, h, title, canvas);
    	this.rectArray.push(newNode);
    };
    skillTree.prototype.addLine = function(x, y, canvas) {
    	var newLine = new classLine(x, y, canvas);
    	this.lineArray.push(newLine);
    };
    skillTree.prototype.draw = function() {
    	for(var node in this.rectArray){
    		
    		this.rectArray[node].draw();
    	}
    	for(var line in this.lineArray){
    		this.lineArray[line].draw();
    	}
    };
    return skillTree;
})();<commit_msg>fix js for new format<commit_after>var classRect = (function() {
	var classRect = function(x, y, w, h, title, canvas) {
		if (x != null && y != null) {
			this.site = {
				'x': x,
				'y': y
			};
		} else {
			this.site = {
				'x': 0,
				'y': 0
			};
		}
		this.title = title;
		this.size = {
			'w': w,
			'h': h
		};
		this.canvas = document.getElementById(canvas);
	};
	classRect.prototype.draw = function(r, g, b) {
		var ctx = this.canvas.getContext('2d');
		if (r != null && g != null && b != null)
			ctx.fillStyle = "rgb(" + r + "," + g + "," + b + ")"; //設定圖形顏色（Red, Green, Blue）
		else
			ctx.fillStyle = "rgb(200,0,0)";
		ctx.fillRect(this.site.x, this.site.y, this.size.w, this.size.h); //設定位置（x, y, width, height）
		ctx.font = "5px Arial";
		ctx.fillStyle = "rgb(0,0,0)";
		ctx.fillText(this.title, this.site.x, this.site.y);
	};
	classRect.prototype.clearAll = function() {

		this.canvas.width = this.canvas.width;
	};
	classRect.prototype.delete = function() {
		var ctx = this.canvas.getContext('2d');
		ctx.clearRect(this.site.x - 1, this.site.y - 1, this.size.w + 1, this.size.h + 1);
	};

	return classRect;
})();

var classLine = (function() {

	var classLine = function(x, y, canvas) {
		this.node = [];
		this.head = {
			'x': x,
			'y': y
		};
		this.canvas = canvas;
	};
	classLine.prototype.addNode = function(x, y) {
		this.node.push({
			'x': x,
			'y': y
		});
	};
	classLine.prototype.draw = function() {
		var ctx = this.canvas.getContext('2d');
		ctx.moveTo(this.head.x, this.head.y);
		console.log(this.head.x + "" + this.head.y);
		for (var n = 0; n < this.node.length; n++) {
			ctx.lineTo(this.node[n].x, this.node[n].y);
			console.log(this.node[n].x + "" + this.node[n].y);
			ctx.stroke();
			ctx.moveTo(this.node[n].x, this.node[n].y);
		}

	};

	return classLine;
})();

var skillTree = (function() {
	var skillTree = function(sourec) {
		this.classArray = [];
		this.classNumArray = [];
		this.rectArray = [];
		this.lineArray = [];
		for (var i in json._1) {
			this.classNumArray.push(json._1[i].SbjID);
			this.classArray.push(json._1[i].SbjTitle);
		}
		for (var i = 0, x = 0; i < this.classArray.length; i++, x += 18) {
			this.addNode(x, 20, 15, 15, this.classNumArray[i], "tab1");
		}
	}
	skillTree.prototype.addNode = function(x, y, w, h, title, canvas) {
		var newNode = new classRect(x, y, w, h, title, canvas);
		this.rectArray.push(newNode);
	};
	skillTree.prototype.addLine = function(x, y, canvas) {
		var newLine = new classLine(x, y, canvas);
		this.lineArray.push(newLine);
	};
	skillTree.prototype.draw = function() {
		for (var node in this.rectArray) {

			this.rectArray[node].draw();
		}
		for (var line in this.lineArray) {
			this.lineArray[line].draw();
		}
	};
	return skillTree;
})();
{'fraction_non_alphanumeric': 0.18981866577940443, 'fraction_numerical': 0.010813508567626019, 'mean_word_length': 2.2149732620320854, 'pattern_counts': {'":': 0, '<': 7, '<?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': '700529', 'n_tokens_mistral': 2389, 'n_tokens_neox': 2253, 'n_words': 435}