<commit_before># transpose.coffee - <NAME>
# Given an original key and a new key, transpose a given note

s11 = require 'sharp11'

module.exports = (origKey, newKey, chordStr) ->
  chord = s11.chord.create(chordStr)
  interval = s11.note.create(origKey).getInterval(newKey)
  newNote = chord.root.transpose(interval).clean()

  chordStr.replace(new RegExp('^' + chord.root), newNote)<commit_msg>Added try catch in transpose function<commit_after># transpose.coffee - <NAME>
# Given an original key and a new key, transpose a given note

s11 = require 'sharp11'

module.exports = (origKey, newKey, chordStr) ->
  try
    chord = s11.chord.create(chordStr)
    interval = s11.note.create(origKey).getInterval(newKey)
    newNote = chord.root.transpose(interval).clean()

    chordStr.replace(new RegExp('^' + chord.root), newNote)
  catch err
    chordStr
{'fraction_non_alphanumeric': 0.1242672919109027, 'fraction_numerical': 0.01875732708089097, 'mean_word_length': 4.4743589743589745, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6926140', 'n_tokens_mistral': 311, 'n_tokens_neox': 289, 'n_words': 72}