Prefer short sentences
This commit is contained in:
parent
bd114d4ae0
commit
c3966a1098
1 changed files with 7 additions and 2 deletions
|
|
@ -87,6 +87,9 @@
|
||||||
(println message)
|
(println message)
|
||||||
(System/exit status))
|
(System/exit status))
|
||||||
|
|
||||||
|
(defn count-words [sentence]
|
||||||
|
(inc (count (re-seq #" " sentence))))
|
||||||
|
|
||||||
(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))]
|
||||||
|
|
@ -95,8 +98,10 @@
|
||||||
(log/warn "Please set :access-token and :mastodon-instance in the .env file.")
|
(log/warn "Please set :access-token and :mastodon-instance in the .env file.")
|
||||||
(log/warn "The bot is running in debug mode for now."))
|
(log/warn "The bot is running in debug mode for now."))
|
||||||
(loop [sentence (generate-sentence markov-chain)]
|
(loop [sentence (generate-sentence markov-chain)]
|
||||||
|
(when (< (count-words sentence) 20)
|
||||||
|
;; shorter sentences are more likely to be coherent. :)
|
||||||
(send-toot! sentence)
|
(send-toot! sentence)
|
||||||
(Thread/sleep (* interval 1000))
|
(Thread/sleep (* interval 1000)))
|
||||||
(recur (generate-sentence markov-chain)))))
|
(recur (generate-sentence markov-chain)))))
|
||||||
|
|
||||||
(defn -main [& args]
|
(defn -main [& args]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue