 (require '[babel.log :refer [log4j!]])
 (require '[babel.parse :as parse])
 (require '[babel.ug :refer :all])
-(require '[babel.writer :as writer :refer [process reload write-lexicon]])
+(require '[babel.writer :as writer :refer [write-lexicon]])
 (require '[clojure.string :as string])
 (require '[clojure.tools.logging :as log])
 (require '[dag_unify.core :refer (fail? get-in strip-refs)])

(def use-map-fn pmap)

(defn root-verbs [lexicon]
  (let [lexemes (vals lexicon)]
    (zipmap
     (keys lexicon)
     (use-map-fn (fn [lexeme-set]
                   (filter (fn [lexeme]
                             (and
                              ;; how to only generate for a single infinitive (for testing/development):
                              ;;                           (= (get-in lexeme [:espanol :espanol]) "abandonar")
                                  (= (get-in lexeme [:synsem :cat]) :verb)
                                  (= (get-in lexeme [:synsem :infl]) :top)
                                  (not (= :top (get-in lexeme [:synsem :sem :pred] :top)))))
                           lexeme-set))
                 lexemes))))

(defn todos [ & [count lexeme]]
  (let [count (if count (Integer. count) 10)

    (.size
     (->> root-verb-array
          (use-map-fn
           (fn [verb]
             (log/debug (str "verb: " (strip-refs verb)))
             (let [root-form (get-in verb [:espanol :espanol])
                   spec {:root {:espanol {:espanol root-form}}}]
               (log/info (str "generating with verb: '" root-form "'"))
               (writer/generate-from-spec
                model (strip-refs spec)
                (vals babel.espanol.grammar/tenses)
                [{:gender :masc} {:gender :fem}]
                [:1st :2nd :3rd]
                [:sing :plur]))))))))

