Created
March 1, 2022 03:54
-
-
Save hexpunk/2049cffce5b2243c2f2ab2d57a91ef2d to your computer and use it in GitHub Desktop.
Awk script to assist in consonant-vowel frequency analysis
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
#!/bin/awk -f | |
# Converts words into consonant-vowel patterns | |
# Combine output with `sort | uniq -c | sort -rg` to list most to least common | |
{ | |
split(tolower($1), chars, "") | |
for (i in chars) { | |
char = chars[i] | |
if (char ~ /[aeiou]/) { | |
printf("v") | |
} else { | |
printf("c") | |
} | |
} | |
printf("\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment