Last active
April 29, 2016 22:53
-
-
Save jdp/ea8ab777e2b6d6206c61fe444df9b183 to your computer and use it in GitHub Desktop.
Solution to Daily Programmer 264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk 'NF {print $NF}' | tr a-z A-Z | tr -d .,\"—\; | | |
xargs -n 1 -I % grep '^% ' cmudict-0.7b | | |
perl -lne 'if (/.*\b((AA|AE|AH|AO|AW|AY|EH|ER|EY|IH|IY|OW|OY|UH|UW).*)/) {print $1}' | | |
tr -d 0-9 | awk 'BEGIN{i=1} !seen[$0] {seen[$0]=i++} {print seen[$0]}' | tr 1-9 a-j | tr -d '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
last-words() { | |
awk 'NF {print $NF}' | tr a-z A-Z | tr -d .,\"—\; | |
} | |
pronunciations() { | |
xargs -n 1 -I % grep '^% ' cmudict-0.7b | |
} | |
rhyme-endings() { | |
perl -lne 'if (/.*\b((AA|AE|AH|AO|AW|AY|EH|ER|EY|IH|IY|OW|OY|UH|UW).*)/) {print $1}' | |
} | |
rhyme-scheme() { | |
tr -d 0-9 | awk 'BEGIN{i=1} !seen[$0] {seen[$0]=i++} {print seen[$0]}' | tr 1-9 a-j | tr -d '\n' | |
} | |
last-words | pronunciations | rhyme-endings | rhyme-scheme |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment