<commit_before>'use strict';

class CommandLineEditor {
  /**
   * @param {Array<String>} lines
   * @param {Object} opts
   * @param {Array} opts.selections
   * @param {String} opts.word
   * @param {String} opts.pathToFile
   */
  constructor(lines, opts) {
    this._lines = lines;
    this._messages = [];
    this._askForSelections = [];
    if (opts.selections && opts.selections.length) {
      this._selections = opts.selections;
    }
    this._word = opts.word;
    this._pathToFile = opts.pathToFile;
  }


  /**
   * @return {String}
   */
  currentWord() {
    return this._word;
  }

  /**
   * @return {String}
   */
  pathToCurrentFile() {
    return this._pathToFile;
  }

  /**
   * @param {String} filePath
   */
  openFile(filePath) {
    this.goto = filePath;
  }

  /**
   * @param {String} str
   */
  message(str) {
    this._messages.push(str);
  }

  /**
   * @return {String}
   */
  currentFileContent() {
    return this._lines.join('\n');
  }

  /**
   * @return {String}
   */
  messages() {
    return this._messages.join('\n');
  }

  /**
   * Reads a line from the file.
   * Lines are one-indexed, so 1 means the first line in the file.
   * @param {Number} lineNumber
   * @return {String}
   */
  readLine(lineNumber) {
    return this._lines[lineNumber - 1];
  }

  /**
   * Delete a line.
   * @param {Number} lineNumber One-indexed line number.
   *   1 is the first line in the file.
   */
  deleteLine(lineNumber) {
    this._lines.splice(lineNumber - 1, 1);
  }

  /**
   * Append a line right after the specified line.
   * Lines are one-indexed, but you need to support appending to line 0 (add
   * content at top of file).
   * @param {Number} lineNumber
   */
  appendLine(lineNumber, str) {
    this._lines.splice(lineNumber, 0, str);
  }

  /**
   * Count the number of lines in the file.
   * @return {Number} the number of lines in the file
   */
  countLines() {
    return this._lines.length;
  }

  /**
   * Ask the user to select something from a list of alternatives.
   *
   * @param {String} word The word/variable to import
   * @param {Array<String>} alternatives A list of alternatives
   * @return {?Number} the index of the selected alternative, or null if
   *   nothing was selected.
   */
  askForSelection(word, alternatives) {
    if (this._selections) {
      // this is a re-run, where selections have already been made
      return this._selections[word];
    }
    this._askForSelections.push({ word, alternatives });<commit_msg>Add missing JSDoc in CommandLineEditor<commit_after>'use strict';

class CommandLineEditor {
  /**
   * @param {Array<String>} lines
   * @param {Object} opts
   * @param {Array} opts.selections
   * @param {String} opts.word
   * @param {String} opts.pathToFile
   */
  constructor(lines, opts) {
    this._lines = lines;
    this._messages = [];
    this._askForSelections = [];
    if (opts.selections && opts.selections.length) {
      this._selections = opts.selections;
    }
    this._word = opts.word;
    this._pathToFile = opts.pathToFile;
  }


  /**
   * @return {String}
   */
  currentWord() {
    return this._word;
  }

  /**
   * @return {String}
   */
  pathToCurrentFile() {
    return this._pathToFile;
  }

  /**
   * @param {String} filePath
   */
  openFile(filePath) {
    this.goto = filePath;
  }

  /**
   * @param {String} str
   */
  message(str) {
    this._messages.push(str);
  }

  /**
   * @return {String}
   */
  currentFileContent() {
    return this._lines.join('\n');
  }

  /**
   * @return {String}
   */
  messages() {
    return this._messages.join('\n');
  }

  /**
   * Reads a line from the file.
   * Lines are one-indexed, so 1 means the first line in the file.
   * @param {Number} lineNumber
   * @return {String}
   */
  readLine(lineNumber) {
    return this._lines[lineNumber - 1];
  }

  /**
   * Delete a line.
   * @param {Number} lineNumber One-indexed line number.
   *   1 is the first line in the file.
   */
  deleteLine(lineNumber) {
    this._lines.splice(lineNumber - 1, 1);
  }

  /**
   * Append a line right after the specified line.
   * Lines are one-indexed, but you need to support appending to line 0 (add
   * content at top of file).
   * @param {Number} lineNumber
   * @param {String} str
   */
  appendLine(lineNumber, str) {
    this._lines.splice(lineNumber, 0, str);
  }

  /**
   * Count the number of lines in the file.
   * @return {Number} the number of lines in the file
   */
  countLines() {
    return this._lines.length;
  }

  /**
   * Ask the user to select something from a list of alternatives.
   *
   * @param {String} word The word/variable to import
   * @param {Array<String>} alternatives A list of alternatives
   * @return {?Number} the index of the selected alternative, or null if
   *   nothing was selected.
   */
  askForSelection(word, alternatives) {
    if (this._selections) {
      // this is a re-run, where selections have already been made
      return this._selections[word];
    }
    this._askForSelections.push({ word, alternatives });
{'fraction_non_alphanumeric': 0.1337025316455696, 'fraction_numerical': 0.002768987341772152, 'mean_word_length': 2.5264993026499303, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6403885', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1653, 'n_words': 457}