Created
March 23, 2025 20:51
-
-
Save rabidaudio/5b0dd6167de1b4ef3bcbfedc8369420c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'csv' | |
data = <<~CSV | |
Album Track Tags Places Swears | |
This Is A Long Drive For Someone With Nothing To Think About Dramamine travel:distance, drugs:otc, geography, listerine, death, sleep:dreaming damn | |
This Is A Long Drive For Someone With Nothing To Think About Breakthrough light:sunlight, air | |
This Is A Long Drive For Someone With Nothing To Think About Custom Concern biome:desert, religion:church, labor:job, travel:parkinglot | |
This Is A Long Drive For Someone With Nothing To Think About Might comedy damn | |
This Is A Long Drive For Someone With Nothing To Think About Lounge light, vehicle:car, math, dancing, cold | |
This Is A Long Drive For Someone With Nothing To Think About Beach Side Property biome:beach, water:ocean, water:river, religion:god, telephone, labor:union, citytown:expansion California | |
This Is A Long Drive For Someone With Nothing To Think About She Ionizes And Atomizes light:sunlight, light:flurescent, science:gravity, science:atom | |
This Is A Long Drive For Someone With Nothing To Think About Head South biome:beach, water:swimming, biome:tundra, cold:snow, geography | |
This Is A Long Drive For Someone With Nothing To Think About Dog Paddle vehicle:truck, vehicle:gas, water:swimming, animal:mammal:dog, geography Carolina | |
This Is A Long Drive For Someone With Nothing To Think About Novocain Stain citytown:expansion, drugs:otc, tv | |
This Is A Long Drive For Someone With Nothing To Think About Tundra/Desert biome:tundra, cold:snow, heat, biome:desert, water, air, money, labor:job, drugs:alcohol fuck, shit | |
This Is A Long Drive For Someone With Nothing To Think About Ohio travel:driving, vehicle:bus, money:gambling, light, sleep, vehicle:crash Ohio, Baltimore | |
This Is A Long Drive For Someone With Nothing To Think About Exit Does Not Exist travel:road, light:sunlight, citytown, labor:job, air:breath | |
This Is A Long Drive For Someone With Nothing To Think About Talking Shit About A Pretty Sunset dancing, school:highschool, light:sunlight shit, damn | |
This Is A Long Drive For Someone With Nothing To Think About Make Everyone Happy/Mechanical Birds animal:bird | |
This Is A Long Drive For Someone With Nothing To Think About Space Travel Is Boring space:moon, travel, poverty:class damn | |
This Is A Long Drive For Someone With Nothing To Think About Edit The Sad Parts geography, comedy, air, money:gambling | |
This Is A Long Drive For Someone With Nothing To Think About A Manic Depressive Named Laughing Boy comedy, heat:burningbuilding | |
The Fruit That Ate Itself The Waydown science:gravity, time, school | |
The Fruit That Ate Itself Dirty Fingernails dirt | |
The Fruit That Ate Itself Sunspots In The House Of The Late Scapegoat light:sunlight, vehicle:bus, travel:distance, citytown:expansion, vehicle:car, blood damn | |
The Fruit That Ate Itself The Fruit That Ate Itself travel:driving, money:buysell, animal:bird:chicken, water:rain, space:blackhole, telephone, vehicle:train, drugs:alcohol, water:swimming, biome:beach | |
The Fruit That Ate Itself Summer vehicle:car, money:theft, dancing, water:swimming | |
The Fruit That Ate Itself Karma's Payment money:debt, vehicle:car, sleep, drugs:caffinepills, vehicle:crash, vehicle:engine, drugs:illicit California, Los Angeles | |
The Lonesome Crowded West Teeth Like God's Shoeshine religion:god, animal:reptile:snake, citytown:desolate, water:ocean, biome:beach, light:sunlight, air, tv, money, travel:distance, telephone, coal, citytown, heat:burning Montana damn, shit | |
The Lonesome Crowded West Heart Cooks Brain biome:beach, animal:bird:raven, animal:bird:seagull, animal:mammal:buffalo, religion:god, coal, air, time:slow Vancourver | |
The Lonesome Crowded West Convenient Parking blood, travel:road, travel:parkinglot, rock, money:buysell | |
The Lonesome Crowded West Lounge (Closing Time) dancing, drugs:illicit, animal:mammal:porcupine, telephone, coal | |
The Lonesome Crowded West Jesus Christ Was An Only Child religion:jesus, water:river, animal:mammal:dog, religion:god, drugs:alcohol, space:planet, money fuck, ass | |
The Lonesome Crowded West Doin' The Cockroach religion:heaven, religion:hell, travel, vehicle:train, vehicle:bus, animal:mammal:dog, animal:insect:cockroach, money:theft, time, geography, sleep, labor | |
The Lonesome Crowded West Cowboy Dan citytown:expansion, vehicle:truck, religion:god, air, drugs:alcohol, citytown, air:breath, gun | |
The Lonesome Crowded West Trailer Trash cold:snow, school:highschool, time, poverty:trailerpark, labor | |
The Lonesome Crowded West Out Of Gas travel:gas, travel:road, drugs:alcohol, animal:mammal:cat | |
The Lonesome Crowded West Long Distance Drunk travel:distance, drugs:alcohol, telephone | |
The Lonesome Crowded West Shit Luck vehicle:plane, vehicle:boat, heat:burningbuilding, vehicle:crash, water:sinking | |
The Lonesome Crowded West Trucker's Atlas travel:road, vehicle:truck, vehicle:train, geography, telephone, animal:bird, blood, heat:warm, drugs:illicit Colorado, New York, Arizona, Alaska, Montana, California, Florida fuck | |
The Lonesome Crowded West Polar Opposites drugs:alcohol, sleep, animal:mammal:dog, vehicle:car, death | |
The Lonesome Crowded West Bankrupt On Selling religion:angels, religion:jesus, religion:hell, school:college, drugs:alcohol, money:buysell, money:broke, poverty | |
The Lonesome Crowded West Styrofoam Boots / It's All Nice On Ice, Alright water:drowning, water:floating, religion:jesus, religion:heaven, religion:god, telephone, listerine, cold:ice damn | |
Building Nothing Out Of Something Never Ending Math Equation math, vehicle:plane, space:universe, animal, animal:mammal:cat, death damn | |
Building Nothing Out Of Something Interstate 8 travel:road, drugs:illicit, travel:distance, time, water, religion:angels, religion:devil damn | |
Building Nothing Out Of Something Broke money:broke, poverty, money:buysell, cold:ice, time, vehicle:car, drugs:alcohol shit | |
Building Nothing Out Of Something Medication drugs:perscription, religion:heaven, space, animal:insect:ant, dirt | |
Building Nothing Out Of Something Workin' On Leavin' The Livin' religion:heaven, death, travel:driving, drugs:alcohol damn | |
Building Nothing Out Of Something All Nite Diner drugs:alcohol, air:breath | |
Building Nothing Out Of Something Baby Blue Sedan vehicle:car, dancing | |
Building Nothing Out Of Something A Life Of Arctic Sounds biome:tundra, travel:distance, space:sun, comedy damn | |
Building Nothing Out Of Something Sleepwalking sleep, poverty, travel:parkinglot, drugs:alcohol | |
Building Nothing Out Of Something Grey Ice Water cold:ice, water, labor:job, telephone, animal:fish, biome:tundra, vehicle:boat, money Alaska, Arctic | |
Building Nothing Out Of Something Whenever You Breathe Out, I Breathe In (Positive/Negative) time, air:breath, math, time, sleep, labor:job | |
Building Nothing Out Of Something Other People's Lives travel:road, vehicle:gas, drugs:illicit, vehicle:car, drugs:alcohol | |
The Moon & Antarctica Third Planet space:earth, space:universe, religion:god, religion:angels, water:swimming, water:ocean, animal, labor:boss, labor:quit fuck, cum | |
The Moon & Antarctica Gravity Rides Everything science:gravity, sleep | |
The Moon & Antarctica Dark Center Of The Universe air, space:universe, cold:ice, water:ocean, biome:desert, religion:god, death ass, fuck | |
The Moon & Antarctica Perfect Disguise citytown, gun ass, damn | |
The Moon & Antarctica Tiny Cities Made Of Ashes citytown, travel:driving, religion:hell, religion:god, telephone | |
The Moon & Antarctica A Different City tv, citytown, blood, money | |
The Moon & Antarctica The Cold Part biome:tundra, cold:ice, travel:distance Antartica | |
The Moon & Antarctica Alone Down There animal:insect:fly, religion:devil, money:debt | |
The Moon & Antarctica The Stars Are Projectors space:stars, space:earth, animal:bird:chicken, religion:god, math, cold, heat | |
The Moon & Antarctica Wild Pack Of Family Dogs animal:mammal:dog, gun, blood, death | |
The Moon & Antarctica Paper Thin Walls money:bank, comedy, time | |
The Moon & Antarctica I Came As A Rat animal:mammal:rat, death, biome:beach, religion:god, sleep, drugs:alcohol, animal:mammal:cat, air, water:swimming, cold:ice, dirt | |
The Moon & Antarctica Lives math, death, religion:god, religion:hell, time | |
The Moon & Antarctica Life Like Weeds death, rock, air:breath, space | |
The Moon & Antarctica What People Are Made Of water:ocean, time, death shit | |
Everywhere And His Nasty Parlour Tricks Willful Suspension Of Disbelief air:sky, dirt, death | |
Everywhere And His Nasty Parlour Tricks Night On The Sun light, space:sun, blood, citytown, travel:distance, dirt, space:earth | |
Everywhere And His Nasty Parlour Tricks 3 Inch horses, Two Faced Monsters animal:mammal:horse, religion:angels, death, time, gun, cold:snow | |
Everywhere And His Nasty Parlour Tricks You're The Good Things death, dirt, water:sinking | |
Everywhere And His Nasty Parlour Tricks So Much Beauty In Dirt dirt, air:breath, money:broke, tv, travel:driving, geography, vehicle:car, space:planet, drugs:alcohol, vehicle:bike, money, water:swimming | |
Everywhere And His Nasty Parlour Tricks Here It Comes labor:job, drugs:alcohol shit | |
Sad Sappy Sucker Worms vs. Birds animal:insect:worm, animal:bird | |
Sad Sappy Sucker Four Fingered Fisherman animal:fish | |
Sad Sappy Sucker Wagon Ride Return vehicle:wagon bastard | |
Sad Sappy Sucker Classy Plastic Lumber telephone, vehicle:engine, dancing | |
Sad Sappy Sucker From Point A To Point B travel:distance, labor, vehicle:train | |
Sad Sappy Sucker Path Of Least Resistance animal:fish | |
Sad Sappy Sucker It Always Rains On A Picnic water:rain | |
Sad Sappy Sucker Dukes Up time, money:broke, poverty | |
Sad Sappy Sucker Think Long death | |
Sad Sappy Sucker Every Penny Fed Car vehicle:car, money:broke | |
Sad Sappy Sucker Mice Eat Cheese animal:mammal:mouse, animal:mammal:cat, drugs:alcohol | |
Sad Sappy Sucker Race Car Grin You Ain't No Landmark vehicle:racecar, money, animal:mammal:horse, poverty | |
Sad Sappy Sucker Red Hand Case drugs:cigarette | |
Sad Sappy Sucker Secret Angent X-9 vehicle:racecar, math, space, telephone, labor:job | |
Sad Sappy Sucker Blue Cadet-3, Do You Connect? space, telephone | |
Sad Sappy Sucker Call To Dial A Song telephone, religion Montana | |
Sad Sappy Sucker 5-4-3-2-1... Lips Off animal:insect, space:astronaut, space:alien | |
Sad Sappy Sucker Woodgrain water, death, poverty | |
Sad Sappy Sucker BMX Crash poverty:trailerpark, vehicle:bike, vehicle:crash | |
Sad Sappy Sucker Sucker Bet money:gambling, money:debt, vehicle:racecar, drugs:cigarette | |
Sad Sappy Sucker Black Blood & Old Newagers blood | |
Sad Sappy Sucker SWY vehicle:car | |
Sad Sappy Sucker Austral Opithecus animal:mammal:cat, animal:mammal:dog | |
Sad Sappy Sucker Sin Gun Chaser gun | |
Good News For People Who Love Bad News The World At Large cold:ice, travel, citytown, labor, water:floating, biome:beach, death, animal:insect:moth | |
Good News For People Who Love Bad News Float On vehicle:car, water:floating, comedy, money:scam, labor | |
Good News For People Who Love Bad News Ocean Breathes Salty water:ocean, death, time, air, space:earth, religion:heaven, religion:hell, air:breath hell | |
Good News For People Who Love Bad News Bury Me With It death, gun, labor:job, space:planet, space:moon, space:stars, animal:bird:hummingbird, vehicle:bus, vehicle:car, water, air, money, poverty, dirt | |
Good News For People Who Love Bad News Dance Hall dancing, animal:mammal:cat, money:scam fuck, damn | |
Good News For People Who Love Bad News Bukowski religion:god, water:river ass | |
Good News For People Who Love Bad News This Devil's Workday water:floating, water:ocean, death, money:buysell, labor:job, animal:mammal:dog, cold:freeze, blood, religion:god damn | |
Good News For People Who Love Bad News The View gun, money:debt, time shit | |
Good News For People Who Love Bad News Satin In A Coffin death, sleep, air:breath, comedy damn | |
Good News For People Who Love Bad News Blame It On The Tetons geography, animal:mammal:dog, animal:insect:spider, heat:burningbuilding, water:drowning, air:breath | |
Good News For People Who Love Bad News Black Cadillacs death, citytown, air, time, dirt, space:stars fuck | |
Good News For People Who Love Bad News One Chance water:sinking | |
Good News For People Who Love Bad News The Good Times Are Killing Me death, dirt, air, water, animal:mammal:dog, citytown dick, shit | |
We Were Dead Before The Ship Even Sank March Into The Sea water:ocean, animal:mammal:rat, animal:insect:flea, animal:mammal:dog, air:breath, telephone, tv | |
We Were Dead Before The Ship Even Sank Dashboard vehicle:car, air, geography, light:sunlight, vehicle:crash | |
We Were Dead Before The Ship Even Sank Fire It Up travel:driving, drugs:alcohol, light:sunlight, vehicle:engine | |
We Were Dead Before The Ship Even Sank Florida animal:mammal:horse, gun, animal:insect:ant, travel:driving, travel:distance Florida shit | |
We Were Dead Before The Ship Even Sank Parting Of The Sensory light:sunlight, science:atom, vehicle:boat, labor:boss, gun, shit, fuck | |
We Were Dead Before The Ship Even Sank Missed The Boat vehicle:boat, water, religion:hell, labor:promotion, vehicle:plane, dancing | |
We Were Dead Before The Ship Even Sank We've Got Everything science, water:ocean, drugs:alcohol, vehicle:car, vehicle:boat, space:stars | |
We Were Dead Before The Ship Even Sank Fly Trapped In A Jar animal:insect:fly, death, drugs:alcohol, money, citytown | |
We Were Dead Before The Ship Even Sank Education vehicle:crash, vehicle:boat, death, animal:mammal:dog, animal:mammal:pony, animal:mammal:monkey, gun, geography shit | |
We Were Dead Before The Ship Even Sank Little Motel sleep, vehicle:boat, vehicle:crash, space:stars, vehicle:car | |
We Were Dead Before The Ship Even Sank Steam Engenius travel:parkinglot, animal:bird, vehicle:car, vehicle:rickshaw, vehicle:crash, damn | |
We Were Dead Before The Ship Even Sank Spitting Venom science:gravity, citytown, water:rain, vehicle:train fuck | |
We Were Dead Before The Ship Even Sank People As Places As People geography, animal:mammal:dog | |
We Were Dead Before The Ship Even Sank Invisible dancing, telephone, vehicle:car, animal:insect:fly, space:moon, water:ocean | |
No One's First And You're Next Satellite Skin space:satellite, animal:insect:moth, space:solarsystem, space:eclipse fuck | |
No One's First And You're Next Guilty Cocker Spaniels animal:mammal:dog, travel:running, money:broke, money:gambling shit | |
No One's First And You're Next Autumn Beds sleep, light:flurescent | |
No One's First And You're Next Whale Song animal:mammal:whale | |
No One's First And You're Next Perpetual Motion Machine science, animal:fish, travel:running, time | |
No One's First And You're Next History Sticks To Your Feet time, coal, cold:ice, light:sunlight | |
No One's First And You're Next King Rat animal:mammal:rat, animal:bird, water, money:debt shit | |
No One's First And You're Next I've Got It All (Most) religion:god, money:theft | |
CSV | |
Track = Struct.new(:album, :track, :tags, :places, :swears) do | |
def initialize(row) | |
super(row['Album'], row['Track'], (row['Tags'] || "").split(", ").uniq, (row['Places'] || "").split(", "), (row['Swears']||"").split(", ")) | |
end | |
end | |
tracks = CSV.parse(data, headers: true, col_sep: "\t").map { |row| Track.new(row) } | |
tracks.count # 131 | |
tracks.map(&:album).uniq.count # 10 | |
unique_tags = tracks.map(&:tags).flatten.uniq.sort | |
unique_tags.count # 141 | |
tag_theme_data = <<~CSV | |
air nature | |
air:breath nature | |
air:sky nature | |
animal nature | |
animal:bird nature | |
animal:bird:chicken nature | |
animal:bird:hummingbird nature | |
animal:bird:raven nature | |
animal:bird:seagull nature | |
animal:fish nature | |
animal:insect nature | |
animal:insect:ant nature | |
animal:insect:cockroach nature | |
animal:insect:flea nature | |
animal:insect:fly nature | |
animal:insect:moth nature | |
animal:insect:spider nature | |
animal:insect:worm nature | |
animal:mammal:buffalo nature | |
animal:mammal:cat nature | |
animal:mammal:dog nature | |
animal:mammal:horse nature | |
animal:mammal:monkey nature | |
animal:mammal:mouse nature | |
animal:mammal:pony nature | |
animal:mammal:porcupine nature | |
animal:mammal:rat nature | |
animal:mammal:whale nature | |
animal:reptile:snake nature | |
biome:beach nature | |
biome:desert nature | |
biome:tundra nature | |
blood bodies | |
citytown geography | |
citytown:desolate geography, poverty | |
citytown:expansion geography, poverty | |
coal nature | |
cold nature | |
cold:freeze nature | |
cold:ice nature | |
cold:snow nature | |
comedy bodies | |
dancing bodies | |
death religion, bodies, nature | |
dirt nature | |
drugs:alcohol bodies, poverty | |
drugs:caffinepills bodies, poverty | |
drugs:cigarette bodies, poverty | |
drugs:illicit bodies, poverty | |
drugs:otc bodies, poverty | |
drugs:perscription bodies, poverty | |
geography nature | |
gun poverty, objects | |
heat nature | |
heat:burning nature | |
heat:burningbuilding nature | |
heat:warm nature | |
labor poverty | |
labor:boss poverty | |
labor:job poverty | |
labor:promotion poverty | |
labor:quit poverty | |
labor:union poverty | |
light nature | |
light:flurescent nature | |
light:sunlight nature | |
listerine bodies | |
math knowledge | |
money poverty | |
money:bank poverty | |
money:broke poverty | |
money:buysell poverty | |
money:debt poverty | |
money:gambling poverty | |
money:scam poverty | |
money:theft poverty | |
poverty poverty | |
poverty:class poverty | |
poverty:trailerpark poverty | |
religion religion | |
religion:angels religion | |
religion:church religion | |
religion:devil religion | |
religion:god religion | |
religion:heaven religion | |
religion:hell religion | |
religion:jesus religion | |
rock nature | |
school knowledge | |
school:college knowledge | |
school:highschool knowledge | |
science knowledge | |
science:atom knowledge | |
science:gravity knowledge | |
sleep bodies | |
sleep:dreaming bodies | |
space knowledge, nature | |
space:alien knowledge, nature | |
space:astronaut knowledge, nature | |
space:blackhole knowledge, nature | |
space:earth knowledge, nature | |
space:eclipse knowledge, nature | |
space:moon knowledge, nature | |
space:planet knowledge, nature | |
space:satellite knowledge, nature | |
space:solarsystem knowledge, nature | |
space:stars knowledge, nature | |
space:sun knowledge, nature | |
space:universe knowledge, nature | |
telephone objects | |
time nature | |
time:slow nature | |
travel travel | |
travel:distance travel | |
travel:driving travel | |
travel:gas travel, poverty | |
travel:parkinglot travel, poverty | |
travel:road travel, geography | |
travel:running travel, bodies | |
tv objects | |
vehicle:bike travel | |
vehicle:boat travel | |
vehicle:bus travel | |
vehicle:car travel | |
vehicle:crash travel | |
vehicle:engine travel, poverty | |
vehicle:gas travel, poverty | |
vehicle:plane travel | |
vehicle:racecar travel | |
vehicle:rickshaw travel | |
vehicle:train travel | |
vehicle:truck travel | |
vehicle:wagon travel | |
water nature | |
water:drowning nature, bodies | |
water:floating nature, bodies | |
water:ocean nature | |
water:rain nature | |
water:river nature | |
water:sinking nature, bodies | |
water:swimming nature, bodies | |
CSV | |
themes = CSV.parse(tag_theme_data, col_sep: "\t").to_h.transform_values { |v| v.split(", ") } | |
unique_themes = themes.values.flatten.uniq # 8 | |
# Themes by Album | |
themes_by_album = tracks.each_with_object({}) do |track, out| | |
out[track.album] ||= unique_themes.map { |t| [t, 0] }.to_h | |
track.tags.each do |tag| | |
themes[tag].each do |theme| | |
out[track.album][theme] += 1 | |
end | |
end | |
end | |
out = CSV.generate(col_sep: "\t") do |csv| | |
csv << ["album", *unique_themes] | |
themes_by_album.each do |album, theme_counts| | |
csv << [album, *unique_themes.map { |t| theme_counts[t] }] | |
end | |
end | |
puts out | |
# Animal Frequency | |
animal_tags = tracks.map(&:tags).flatten.filter { |t| t.start_with?("animal") }.sort.map { |t| t.split(":", 3) } # .tally | |
animal_tags.each { |t| puts t.join("\t") } | |
# Places | |
tracks.map(&:places).flatten.tally | |
# Most song | |
tracks.map { |t| [t, t.tags.map { |t| t.split(":").first }.uniq.count] }.sort_by(&:last) | |
# Swears | |
swears = tracks.map(&:swears).flatten.tally.sort_by(&:last) | |
swears.each do |swear, count| | |
puts "#{swear}\t#{count}" | |
end | |
# % of songs per category | |
puts tracks.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# Travel, vehicles, geography | |
puts tracks.filter { |t| t.tags.any? { |tt| ['travel', 'vehicle', 'geography', 'citytown'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# Religion | |
puts tracks.filter { |t| t.tags.any? { |tt| ['religion'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# Capitalism | |
puts tracks.filter { |t| t.tags.any? { |tt| ['money', 'poverty', 'citytown', 'labor'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# Space, Math, Physics | |
puts tracks.filter { |t| t.tags.any? { |tt| ['math', 'science', 'space', 'time'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# Air, Water, Hot, Cold | |
puts tracks.filter { |t| t.tags.any? { |tt| ['air'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['water'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['cold'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['heat'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['light'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['vehicle'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['religion'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
puts tracks.filter { |t| t.tags.any? { |tt| ['animal'].any? { |c| tt.start_with?(c) } } }.group_by(&:album).transform_values(&:count).map { |v| v.join("\t") }.join("\n") | |
# other | |
['blood', 'coal', 'comedy', 'dancing', 'death', 'dirt', 'gun', 'heat:burningbuilding', 'listerine', 'rock', 'school:college', 'school:highschool', 'sleep', 'telephone', 'time', 'tv'].each do |cat| | |
count = tracks.filter { |t| t.tags.any? {|tt| tt.start_with?(cat)} }.count | |
puts "#{cat}\t#{count}" | |
end | |
# vehicles | |
tracks.map(&:tags).flatten.filter { |t| t.start_with?('vehicle:') }.map { |t| t.delete_prefix('vehicle:') }.tally.sort_by(&:last).reverse.each do |vehicle, count| | |
puts "#{vehicle}\t#{count}" | |
end | |
# space | |
tracks.map(&:tags).flatten.filter { |t| t.start_with?('space:') }.map { |t| t.delete_prefix('space:') }.tally.sort_by(&:last).reverse.each do |vehicle, count| | |
puts "#{vehicle}\t#{count}" | |
end | |
# water | |
tracks.map(&:tags).flatten.filter { |t| t.start_with?('water:') }.map { |t| t.delete_prefix('water:') }.tally.sort_by(&:last).reverse.each do |vehicle, count| | |
puts "#{vehicle}\t#{count}" | |
end | |
# religion | |
tracks.map(&:tags).flatten.filter { |t| t.start_with?('religion:') }.map { |t| t.delete_prefix('religion:') }.tally.sort_by(&:last).reverse.each do |vehicle, count| | |
puts "#{vehicle}\t#{count}" | |
end | |
# money / labor | |
tracks.map(&:tags).flatten.filter { |t| t.start_with?('money:') || t.start_with?('labor:') || t.start_with?('poverty:') }.tally.sort_by(&:last).reverse.each do |vehicle, count| | |
puts "#{vehicle}\t#{count}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment