Created
October 20, 2015 18:20
-
-
Save craftoid/1640e982a49c654d188d to your computer and use it in GitHub Desktop.
The Gender of Every Letter of the Alphabet
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
icons=50 | |
n=$(printf "👻 %0.s" $(seq -s " " 1 $icons)) | |
f=$(printf "🚺 %0.s" $(seq -s " " 1 $icons)) | |
m=$(printf "🚹 %0.s" $(seq -s " " 1 $icons)) | |
for i in {1..26} | |
do | |
char=$(printf "\x$(printf %x $[$i + 96])") | |
json=$(curl -s https://api.genderize.io/?name=$char) | |
gender=$(echo $json | sed 's/.*"gender":"\(.\).*/\1/') | |
if [[ ${#gender} > 1 ]]; then echo "$char: $n"; continue; fi | |
percent=$(echo $json | sed 's/.*"probability":"\(.*\)",.*/\1/') | |
x=$(echo "$icons * $percent * 100 / 100" | bc) | |
if [[ $gender != "f" ]]; then x=$[$icons - $x]; fi | |
printf "$char: ${f::$x*2}${m:$x*2}\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment