In [12]:
# set up all the data for the rest of the notebook
import json
from collections import Counter
from itertools import chain
with open('shreddit_q2_votes.json', 'r') as fh:
ballots = json.load(fh)
In [19]:
def change_name(fuzzy, to):
for ballot in ballots:
for idx, vote in enumerate(ballot):
if vote.startswith(fuzzy):
ballot[idx] = to.lower()
fuzzies = {'Blind Guardian - Beyond the Red Mirror',
'Caedes Cruenta - Ερείπια ψυχών',
'Chapel of Disease - The Mysterious Ways of Repetitive Art',
'Cloud Rat - Qliphoth',
'Crypt Sermon - Out of the Garden',
'Death Karma - The History of Death & Burial Rituals Part 1 ',
'Deathhammer - Evil Power',
'Desolate Shrine - Heart of the Netherworld',
'Drudkh - A Furrow Cut Short',
'Ethereal Shroud - They Became Falling Ash',
'Ghost Bath - Moonlover',
'Gruesome - Savage Land',
'Hic Iacet - The Cosmic Trance into Void',
'Lord Dying - Poised Altars',
'Melechesh - Enki',
'Misþyrming - Söngvar elds og óreiðu',
'Monolord - Vænir',
'Obsequiae - Aria of Vernal Tombs',
'Sulphur Aeon - Gateway to the Antisphere',
'Tribulation - Children of the Night',
'Visigoth - The Revenant King',
'Wilderun - Sleep at the Edge of the Earth'}
for name in fuzzies:
change_name(name.lower()[:5], name)
In [ ]:
fuzzies = {'ithaqua': 'ithaqua - initiation to obscure mysteries',
'dodh': 'dødheimsgard - a umbra omega',
'mispyrming': 'misþyrming - söngvar elds og óreiðu',
'ufomammut': 'ufomammut - ecate',
'forest of stars': 'a forest of stars - a beware the sword you cannot see',
'shining': 'shining ix - everyone, everything, everywhere, ends',
'genocide shrines': 'genocide shrines - Manipura Imperial Deathevokovil: Scriptures of Reversed Puraana Dharmurder'.lower(),
'sigh -': 'sigh - graveward',
'misblerbling - songvar yadda yadda': 'misþyrming - söngvar elds og óreiðu',
'a sulphur aeon': 'sulphur aeon - gateway to the antisphere'}
for fuzzy, replace in fuzzies.items():
change_name(fuzzy, replace)
In [ ]:
with open('shreddit_q2_votes.json', 'w') as fh:
json.dump(ballots, fh)