~nova/mag-fear-scraper

3379d41149ce74e654f802a0395d10402970cc36 — Nova Devereaux 1 year, 3 months ago 2e07bf2 master
Update labels with numbers
1 files changed, 1 insertions(+), 1 deletions(-)

M build.sh
M build.sh => build.sh +1 -1
@@ 4,4 4,4 @@ pup 'a[href*=":_"][href*="MAG"] attr{href}' < Episodes | sort -u | xargs -I {} w
fgrep Related\ Entity MAG* -A 3 | fgrep href | perl -pe 'y/_/ /; s/-//; s/<div.*?">//; s/<\/div>//; s/<a.*?>(.*?)<\/a>[^<]*/$1, /g; s/<.*?>//g; s/(\t.*)(?:Primarily|Possibly) /$1/; s/, $//; $_ .= "\n"' | sort -k 2 -n > episode_fear_list_denormalized.tsv
perl -ne 'chomp; @f = split "\t"; ($id) = ($f[0] =~ /([0-9]*):/); $f[1] =~ s/The //g; @g = split ", ", $f[1]; print "$id\t$_\n" foreach @g' < episode_fear_list_denormalized.tsv > episode_fear_list_normalized.tsv
cut -f 2 episode_fear_list_normalized.tsv | sort | uniq -c | sort -n | perl -ane '@F[0] =~ s/^ *//; print "$F[1]\t$F[0]\n"' > fear_counts.tsv
ploticus -prefab pie -svg data=fear_counts.tsv delim=tab labels=1 values=2 colors=auto; mv pie.svg fear_counts.svg
ploticus -prefab pie -svg data=fear_counts.tsv delim=tab "labelfmtstring=@1 (@2)" values=2 colors=auto; mv pie.svg fear_counts.svg