From a23c3ab5320543524ec929ad5e6b284fbf48acfe Mon Sep 17 00:00:00 2001 From: Eric Ihli Date: Mon, 19 Jul 2021 17:35:26 -0500 Subject: [PATCH] Add convenience method for lyric gen --- .../com/darklimericks/linguistics/core.clj | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/web/src/com/darklimericks/linguistics/core.clj b/web/src/com/darklimericks/linguistics/core.clj index 99ed7bd..27775d3 100644 --- a/web/src/com/darklimericks/linguistics/core.clj +++ b/web/src/com/darklimericks/linguistics/core.clj @@ -400,9 +400,35 @@ (sort-by (comp - second)) first))) +(defn wgu-lyric-suggestions + [phrase] + (let [rhymes (rhymes-by-quality phrase) + seeds (map vector rhymes (repeat "")) + lyrics (map #(lyric-suggestions + (string/join " " %) + models/markov-trie + models/database) + seeds)] + (->> lyrics + (map (juxt identity open-nlp-perplexity)) + (sort-by (comp - second))))) + (comment + (wgu-lyric-suggestions "technology") + (phrase->quality-of-rhyme "boss hog" "brain fog") + (let [rhymes (rhymes-by-quality "bother me") + seeds (map vector rhymes (repeat "")) + lyrics (map #(lyric-suggestions + (string/join " " %) + models/markov-trie + models/database) + seeds)] + (->> lyrics + (map (juxt identity open-nlp-perplexity)) + (sort-by (comp - second)))) + (->> #(lyric-suggestions "bother me " models/markov-trie models/database) repeatedly (take 5)