Include rhyme in best-of calc

main
Eric Ihli 3 years ago
parent 9d0f411012
commit c77e101515

@ -1032,7 +1032,12 @@
banned-words
(into #{} (->> existing-lines
(map (comp last last))))
seed (if existing-lines
line
(take-until
(best-of-20)
(fn []
(let [seed (if existing-lines
(->> existing-lines
rand-nth
reverse
@ -1064,15 +1069,14 @@
database
(#(vector (rand-nth (phonetics/get-phones %)) %))
vector))
line (take-until
(best-of-20)
#(tightly-generate-n-syllable-sentence-v2
line (tightly-generate-n-syllable-sentence-v2
database
markov-trie
4
syllable-count
(make-markov-filter [eos bos])
seed))]
seed)]
line)))]
(recur (rest scheme)
(update result (first scheme) (fnil conj []) line)))))))
@ -1081,6 +1085,19 @@
(rhyme-from-scheme-v2
scheme database markov-tight-trie rhymetrie))
(phonetics/get-phones "unleashed")
(rhymes
rhymetrie
["IY" "SH" "T"]
(fn [choices]
(->> choices
(map (fn [[phones wordset]]
[phones
(set/difference
wordset
#{"unleashed"})]))
(remove (comp empty? second)))))
)
(comment

@ -167,6 +167,12 @@
(#(parse-top-n % 100)))
)
(comment
(likely-sentence?
"have s y como tu cama")
)
(defn valid-sentence?
"Tokenizes and parses the phrase using OpenNLP models from
http://opennlp.sourceforge.net/models-1.5/

Loading…
Cancel
Save