                                                   {:synsem {:sem {:subj subj}}}))
                                          true
                                          target-language-sentence))
-
-        error (if (nil? target-language-sentence)
-                (let [message (str "Could not generate a sentence in target language '"
-                                   (:language target-language-model) 
+        target-fo (:morph target-language-model)
+
+        semantics (strip-refs (get-in target-language-sentence [:synsem :sem] :top))
+
+        ;; 2. generate sentence in source language using semantics of sentence in target language.
+        ;; resolve future
+        source-language-model (if (future? source-language-model)
+                                @source-language-model
+                                source-language-model)
+        debug (log/debug (str "semantics of resulting expression: " semantics))
+        debug (log/trace (str "entire expression: " target-language-sentence))
+
+        target-language-surface (target-fo target-language-sentence)
+        debug (log/debug (str "target surface: " target-language-surface))
+
+        source-language (:language source-language-model)
+        error (if (or (nil? target-language-surface)
+                      (= target-language-surface ""))
+                (let [message (str "Could not generate a sentence in source language '"
+                                   (:language source-language-model) 
                                    "' for this spec: " spec)]
-                  (if (= true mask-populate-errors)
-                    (log/warn message)
-                    ;; else
-                    (let [target-language-model target-language-model]
-                      (log/error message)
-                      (log/error "grammar: " (map :rule (:grammar target-language-model)))
-                      (log/error "lexicon: " (string/join "," (map (:morph target-language-model)
-                                                                   (sort (keys (:lexicon target-language-model))))))
-                      ;; TODO: add partial parses for more diagnostics:
-                      ;; need to try parsing same spec, but without the 
-                      ;;  {:synsem {:subcat '()}} that makes us try to generate
-                      ;; an entire sentence.
-                      (throw (Exception. message))))))
-
-        target-fo (:morph target-language-model)
-        target-language-surface (target-fo target-language-sentence)
-        semantics (strip-refs (get-in target-language-sentence [:synsem :sem] :top))
-
-        error (if (or (nil? target-language-surface)
-                      (empty? target-language-surface))
-                (let [message (str "Surface of target sentence was empty - spec was: " spec "; target-language-sentence was: " target-language-sentence)]
                   (if (= true mask-populate-errors)
                     (log/warn message)
                     ;; else

               [canonical (str (serialize lexeme))
                language]]))

;; TODO: use named optional parameters.
(defn populate [num source-language-model target-language-model & [ spec table ]]
  (let [spec (if spec spec :top)

                                  {:synsem {:sem {:subj subj}}}))
                         true
                         sentence))]
    sentence))

(defn expression-pair [source-language-model target-language-model spec]
  "Generate a pair: {:source <source_expression :target <target_expression>}.
