More demo markov

main
Eric Ihli 3 years ago
parent aecb8d42f1
commit ae9d5bae9b

@ -467,5 +467,59 @@
reverse))
(map (partial remove #{prhyme/BOS}))
(map (partial string/join " "))))
;; => ("funeral has just begun"
;; "dead illusion overdone"
;; "all shout boy for then , outrun"
;; "and those that turn till rerun"
;; "heading for a pack of rerun"
;; "furnace of end outrun"
;; "the deaths outrun"
;; "our funeral has begun"
;; "paper that looking dark rerun"
;; "walk overdone")
(let [target-rhyme (->(prhyme/phrase->all-flex-rhyme-tailing-consonants-phones
"filling")
first
first
reverse)]
(->> (repeatedly
10
#(->> (tightly-generate-n-syllable-sentence-rhyming-with
database
markov-trie
rhyme-trie
target-rhyme
3
3
7)
(map second)
reverse))
(map (partial remove #{prhyme/BOS}))
(map data-transform/untokenize)))
(rhyme-choices-walking-target-rhyme
rhyme-trie
(->> (prhyme/phrase->all-flex-rhyme-tailing-consonants-phones
"filling")
first
first
reverse))
(let [target-rhyme ["IY1" "ER"]]
(->> (repeatedly
10
#(->> (tightly-generate-n-syllable-sentence-rhyming-with
database
markov-trie
rhyme-trie
target-rhyme
3
3
7)
(map second)
reverse))
(map (partial remove #{prhyme/BOS}))
(map (partial string/join " "))))
)

@ -42,6 +42,11 @@
(map (partial map second))
(map (partial mapv string/lower-case))))
(defn untokenize
[coll]
(->> coll
(map #(string/join " " %))
(map #(string/replace % #" (['\-,\?\.] ?)" "$1"))))
(def xf-untokenize
(comp
(map #(string/join " " %))

Loading…
Cancel
Save