<commit_before>/*
 * searchresults.js
 *
 * SearchResult class represents a search result
 */

function SearchResult(pattern, filename, linenum, matchStartIndex, matchEndIndex,
    line, linesBefore, linesAfter) {
    var self = this;
    self.pattern = pattern;
    self.filename = filename;
    self.linenum = linenum;
    self.matchStartIndex = matchStartIndex;
    self.matchEndIndex = matchEndIndex;
    self.line = line;
    self.linesBefore = linesBefore;
    self.linesAfter = linesAfter;
    self.maxLineLength = 150;

    self.toString = function () {
        if (self.linesBefore.length > 0 || self.linesAfter.length > 0) {
            return multiLineToString();
        }
        return singleLineToString();
    };

    var singleLineToString = function () {
        var s = self.filename;
        if (self.linenum && self.line) {
            s += ': ' + self.linenum + ' [' + self.matchStartIndex + ':' +
                self.matchEndIndex +']: ' + formatMatchingLine();
        } else {
            s += ' matches';
        }
        return s;
    };

    var lineNumPadding = function() {
        var maxLineNum = self.linenum + self.linesAfter.length;
        return ("" + maxLineNum).length;
    }

    var padLeft = function(s, i) {
        p = "" + s;
        while (p.length < i) {
            p = " " + p;
        }
        return p;
    }

    var multiLineToString = function () {
        var s = Array(81).join("=") + "\n";
        s += "{0}: {1}: ".format(self.filename, self.linenum);
        s += "[{0}:{1}]\n".format(self.matchStartIndex, self.matchEndIndex);
        s += Array(81).join("-") + "\n";
        var currentLineNum = self.linenum;
        var numPadding = lineNumPadding();
        if (self.linesBefore.length > 0) {
            currentLineNum = currentLineNum - self.linesBefore.length;
            for (var i in self.linesBefore) {
                var b = self.linesBefore[i];<commit_msg>Added linenum colon to node search result<commit_after>/*
 * searchresults.js
 *
 * SearchResult class represents a search result
 */

function SearchResult(pattern, filename, linenum, matchStartIndex, matchEndIndex,
    line, linesBefore, linesAfter) {
    var self = this;
    self.pattern = pattern;
    self.filename = filename;
    self.linenum = linenum;
    self.matchStartIndex = matchStartIndex;
    self.matchEndIndex = matchEndIndex;
    self.line = line;
    self.linesBefore = linesBefore;
    self.linesAfter = linesAfter;
    self.maxLineLength = 150;

    self.toString = function () {
        if (self.linesBefore.length > 0 || self.linesAfter.length > 0) {
            return multiLineToString();
        }
        return singleLineToString();
    };

    var singleLineToString = function () {
        var s = self.filename;
        if (self.linenum && self.line) {
            s += ': ' + self.linenum + ': [' + self.matchStartIndex + ':' +
                self.matchEndIndex +']: ' + formatMatchingLine();
        } else {
            s += ' matches';
        }
        return s;
    };

    var lineNumPadding = function() {
        var maxLineNum = self.linenum + self.linesAfter.length;
        return ("" + maxLineNum).length;
    }

    var padLeft = function(s, i) {
        p = "" + s;
        while (p.length < i) {
            p = " " + p;
        }
        return p;
    }

    var multiLineToString = function () {
        var s = Array(81).join("=") + "\n";
        s += "{0}: {1}: ".format(self.filename, self.linenum);
        s += "[{0}:{1}]\n".format(self.matchStartIndex, self.matchEndIndex);
        s += Array(81).join("-") + "\n";
        var currentLineNum = self.linenum;
        var numPadding = lineNumPadding();
        if (self.linesBefore.length > 0) {
            currentLineNum = currentLineNum - self.linesBefore.length;
            for (var i in self.linesBefore) {
                var b = self.linesBefore[i];
{'fraction_non_alphanumeric': 0.1363286264441592, 'fraction_numerical': 0.007188703465982028, 'mean_word_length': 2.1043824701195217, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '498167', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1149, 'n_words': 261}