     (if (> max-total-depth 0)
       (let [prob (- 1.0 (/ (- max-total-depth depth)
                            max-total-depth))]
-        (log/trace (str "P(c," depth ") = " prob " (c: probablity of choosing lexemes rather than phrases given a depth)."))
+        (log/trace (str "P(c," depth ") = " prob " (c: probability of choosing lexemes rather than phrases given depth " depth ")"))
         (> (* 10 prob) (rand-int 10)))
       false)))
 

  [language-model spec depth total-depth
                       & {:keys [max-total-depth]
                          :or {max-total-depth max-total-depth}}]
  (let [grammar (:grammar language-model)
        depth (if depth depth 0)
        ;; this is the relative depth; that is, the depth from the top of the current lightning bolt.
        ;; total-depth, on the other hand, is the depth all the way to the top of the entire
        ;; expression, which might involve several parent lightning bolts.
        parents (shuffle (candidate-parents grammar spec))]
    (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
          (when (= false (get-in spec [:head :phrasal] false))
            (lazy-mapcat

               (log/debug (str "parent: " (:rule parent) " over lexical heads."))
               (let [lexicon (or (:lexicon (:generate language-model)) (:lexicon language-model))
                     subset (if-let [index-fn (:index-fn language-model)]
                              (do
                                (log/debug (str "using index to find lexical heads for parent:"
                                                (:rule parent)))
                                (index-fn (get-in parent [:head] :top)))
                              (flatten (vals lexicon)))]
                 (let [result
                       (mapcat #(do
                                  (log/debug (str "trying parent: " (:rule parent) " with lexical head:"
                                                  ((:morph language-model) %)))
                                  (over/overh parent %))
                               (shuffle subset))]
                   (if (and (not (empty? subset)) (empty? result)
                            (> (count subset)
