   (r/fold clojure.set/union clojure.set/union
     (mapv word-triples coll)))
 
-;; (corpus/with-corpus []
-;;   (count (word-collection-triples (:all-words corpus/*corpus*))))
-    
+
 (defn file-triples [filename]
   (r/fold clojure.set/union clojure.set/union
-    (mapv word-triples (corpus/words-from-file filename))))
+    (mapv word-triples (words-from-file filename))))
 
 ;; (util/run-and-measure-timing 
-;;   (count (file-triples corpus/+default-corpus-file+)))
+;;   (count (file-triples +default-corpus-file+)))
 ;;
 ;;  => {:response         4511728,
 ;;      :start-time 1401197847802,

;; Database Management
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn set-graph! [graph]
  (swap! db (constantly graph)))

(defn clear-db! []
  (set-graph! nil))

(defn build-db!
  ([]
     (build-db! +default-corpus-file+))
  ([filename]
     (set-graph! (make-graph (file-triples filename)))
     @db))

;;;
;;  These are the actual "top-level" database API functions which are pleasantly
;; trivial to implement using the facilities we have created for parsing and
;; graph construction.  Primarily, these are responsible for atomic interaction
;; with global state, which is limited to only the single var 'db'.
;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

               (if (empty? posns)
                 (list (list word c -1))
                 (map #(conj (list c %) word) posns)))))
         [(tuple word :length (count word))
          (tuple word :type   :WORD)]
         )))

;; (word-triples "abccddd")

