<commit_before>export default class Converter {
  /**
   * @param {number} nn - note number
   * @param {string} scale
   */
  constructor(nn, scale) {
    this.nn = nn;
    this.scale = scale;
    this.key = 0; // C = 0, D = 2, B = 11
  }

  /**
   * @returns {number}
   */
  toRowIndex() {
    const scaleArray = this[`${this.scale}Scale`]();
    const pitchNumber = this.allPitch()[this.noteName()];

    let additionalIdx = scaleArray.findIndex((v, i) => {
      return pitchNumber <= v;
    });

    console.log(this.noteNameWithOctave(), pitchNumber, 'additionalIdx', additionalIdx);

    return this.octave() * 7 + additionalIdx;
  }

  allPitch() {
    return {
      'G': 0,
      'G#': 1,
      'A': 2,
      'A#': 3,
      'B': 4,
      'C': 5,
      'C#': 6,
      'D': 7,
      'D#': 8,
      'E': 9,
      'F': 10,
      'F#': 11
    };
  }

  majorScale() {
    return [0, 2, 4, 5, 7, 9, 11];
  }

  naturalMinorScale() {
    return [0, 2, 3, 5, 7, 8, 10];
  }

  noteNameWithOctave() {
    const octave = Math.floor(this.nn / 12) - 2;
    return `${this.noteName()}${octave}`;
  }

  octave() {
    return Math.floor(this.nn / 12) - 2;<commit_msg>refactor(index): scale<commit_after>export default class Converter {
  /**
   * @param {number} nn - note number
   * @param {string} scale
   */
  constructor(nn, scale) {
    this.nn = nn;
    this.scale = scale;
    this.key = 0; // C = 0, D = 2, B = 11
  }

  /**
   * @returns {number}
   */
  toRowIndex() {
    const scaleArray = this[`${this.scaleArray()[this.scale]}`];
    const pitchNumber = this.allPitch()[this.noteName()];

    let additionalIdx = scaleArray.findIndex((v, i) => {
      return pitchNumber <= v;
    });

    // console.log(this.noteNameWithOctave(), pitchNumber, 'additionalIdx', additionalIdx);

    return this.octave() * 7 + additionalIdx;
  }

  allPitch() {
    return {
      'G': 0,
      'G#': 1,
      'A': 2,
      'A#': 3,
      'B': 4,
      'C': 5,
      'C#': 6,
      'D': 7,
      'D#': 8,
      'E': 9,
      'F': 10,
      'F#': 11
    };
  }

  scaleArray() {
    return {
      'major': [0, 2, 4, 5, 7, 9, 11],
      'naturalMinor': [0, 2, 3, 5, 7, 8, 10]
    };
  }

  noteNameWithOctave() {
    const octave = Math.floor(this.nn / 12) - 2;
    return `${this.noteName()}${octave}`;
  }

  octave() {
    return Math.floor(this.nn / 12) - 2;
{'fraction_non_alphanumeric': 0.19686041578277472, 'fraction_numerical': 0.03563852354688163, 'mean_word_length': 2.1067193675889326, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1591077', 'n_tokens_mistral': 1001, 'n_tokens_neox': 904, 'n_words': 214}