<commit_before>(ns tenor.entities)

(defrecord Note [note-value pitch-letter octave])

(defn make-note [notation]
  (let [notation-re #"^(1|2|4|8|16)([A-G])([#b]?)([1-9])$"
        components (re-matches notation-re notation)]
    (if components
      (->Note
        (Integer. (nth components 1))
        (str (nth components 2) (nth components 3))
        (Integer. (nth components 4)))
      "Invalid notation")))

(defn time-signature [beat-count & [sig]]
  (cond
    (> beat-count 3)
    (let [beats (rand-nth [2 3 4])
          sig (concat (or sig '()) (range 1 (inc beats)))]
      (time-signature (- beat-count beats) sig))
    (and (<= beat-count 3) (> beat-count 0))
    (let [sig (concat (or sig '()) (range 1 (inc beat-count)))]
      (time-signature 0 sig))
    :else sig))
<commit_msg>Use exception instead of string<commit_after>(ns tenor.entities)

(defrecord Note [note-value pitch-letter octave])

(defn make-note [notation]
  (let [notation-re #"^(1|2|4|8|16)([A-G])([#b]?)([1-9])$"
        components (re-matches notation-re notation)]
    (if components
      (->Note
        (Integer. (nth components 1))
        (str (nth components 2) (nth components 3))
        (Integer. (nth components 4)))
      (throw (Exception. "Invalid notation")))))

(defn time-signature [beat-count & [sig]]
  (cond
    (> beat-count 3)
    (let [beats (rand-nth [2 3 4])
          sig (concat (or sig '()) (range 1 (inc beats)))]
      (time-signature (- beat-count beats) sig))
    (and (<= beat-count 3) (> beat-count 0))
    (let [sig (concat (or sig '()) (range 1 (inc beat-count)))]
      (time-signature 0 sig))
    :else sig))

{'fraction_non_alphanumeric': 0.18631643249847282, 'fraction_numerical': 0.02565668906536347, 'mean_word_length': 2.8632075471698113, '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': '4855896', 'n_tokens_mistral': 606, 'n_tokens_neox': 573, 'n_words': 168}