Skip to content

Instantly share code, notes, and snippets.

@yedi
Created November 23, 2012 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yedi/4134413 to your computer and use it in GitHub Desktop.
Save yedi/4134413 to your computer and use it in GitHub Desktop.
rhyme-finder.core> (def poem-line (nth (get-poem "poems/test.txt") 2))
#'rhyme-finder.core/poem-line
rhyme-finder.core> (clojure.string/split poem-line #"\s")
["It" "is" "not" "quite" "the" "best"]
rhyme-finder.core> (map test-prons (clojure.string/split poem-line #"\s"))
(nil ["" "ih" "z"] ["" "n" "aa" "t"] ["" "k" "w" "ay" "t"] ["" "dh" "ah"] ["" "b" "eh" "s" "t"])
rhyme-finder.core> poem-line
"It is not quite the best"
rhyme-finder.core> (test-prons "it")
["" "ih" "t"]
rhyme-finder.core> (concat (map test-prons (clojure.string/split poem-line #"\s")))
(nil ["" "ih" "z"] ["" "n" "aa" "t"] ["" "k" "w" "ay" "t"] ["" "dh" "ah"] ["" "b" "eh" "s" "t"])
rhyme-finder.core> test-prons
{"outperforms" ["" "aw" "t" "p" "er" "f" "ao" "r" "m" "z"], "fest" ["" "f" "eh" "s" "t"], "a" ["" "ah"], "but" ["" "b" "ah" "t"], "behest" ["" "b" "ih" "hh" "eh" "s" "t"], "best" ["" "b" "eh" "s" "t"], "for" ["" "f" "ao" "r"], "is" ["" "ih" "z"], "it" ["" "ih" "t"], "my" ["" "m" "ay"], "enough" ["" "ih" "n" "ah" "f"], "the" ["" "dh" "ah"], "test" ["" "t" "eh" "s" "t"], "at" ["" "ae" "t"], "not" ["" "n" "aa" "t"], "rest" ["" "r" "eh" "s" "t"], "quite" ["" "k" "w" "ay" "t"], "this" ["" "dh" "ih" "s"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment