Add examples function for a nicer REPL time
This commit is contained in:
parent
f243aea8c4
commit
b17f556758
1 changed files with 7 additions and 0 deletions
|
|
@ -99,6 +99,13 @@
|
||||||
(defn count-words [sentence]
|
(defn count-words [sentence]
|
||||||
(inc (count (re-seq #" " sentence))))
|
(inc (count (re-seq #" " sentence))))
|
||||||
|
|
||||||
|
(defn examples
|
||||||
|
"Will return a preview of the text that will be generated."
|
||||||
|
[corpus order]
|
||||||
|
(let [markov-chain (->> (read-corpus corpus)
|
||||||
|
(markov/chain order))]
|
||||||
|
(repeatedly 10 #(generate-sentence markov-chain))))
|
||||||
|
|
||||||
(defn start! [{:keys [corpus order interval]}]
|
(defn start! [{:keys [corpus order interval]}]
|
||||||
(let [markov-chain (->> (read-corpus corpus)
|
(let [markov-chain (->> (read-corpus corpus)
|
||||||
(markov/chain order))]
|
(markov/chain order))]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue