feat(parles): MVP

parent 0efd872f
import json
import os
from collections import defaultdict
def analyse():
path = "../data/"
files = os.listdir(path)
stats = {
"avg_length": defaultdict(lambda: 0),
"missing": defaultdict(lambda: 0)
}
for filename in files:
with open(path + filename) as f:
content = json.load(f)
artist = content["name"]
songs = content["songs"]
print("\n## %s ##" % artist)
for song in songs:
title = song["title"]
if song["lyrics"] is not None:
lyrics = song["lyrics"]
stats["avg_length"][artist] += len(lyrics)
else:
stats["missing"][artist] += 1
stats["avg_length"][artist] /= len(songs)
print("%s: Average song is %i long (%i missing)." % (
artist, stats["avg_length"][artist], stats["missing"][artist]))
if __name__ == '__main__':
analyse()
LeBoulbiNet/boulbi.jpg

73.7 KB | W: | H:

LeBoulbiNet/boulbi.jpg

85 KB | W: | H:

LeBoulbiNet/boulbi.jpg
LeBoulbiNet/boulbi.jpg
LeBoulbiNet/boulbi.jpg
LeBoulbiNet/boulbi.jpg
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment