In [95]:
import json
In [96]:
fileObj = open('tfidf.json', 'r')
tfidfDict = json.load(fileObj)
fileObj.close()

fileObj = open('sentiment_by_graf.json', 'r')
sentDict = json.load(fileObj)
fileObj.close()
In [97]:
newDict = dict()
In [98]:
tfidfDict.keys()
Out[98]:
[u'Galapagos',
 u'Bluebeard',
 u'Breakfast of Champions',
 u'Deadeye Dick',
 u'Basic Training',
 u'Slapstick',
 u'Armageddon In Retrospect',
 u'Slaughterhouse-Five',
 u'Jailbird',
 u'Mother Night',
 u'Happy Birthday, Wanda June',
 u'God Bless You, Dr. Kevorkian',
 u'Palm Sunday',
 u'We Are What We Pretend to Be',
 u"If This Isn't Nice, What Is",
 u'Man without a Country, A',
 u"Cat's Cradle",
 u'Sirens of Titan, The',
 u'Welcome to the Monkey House',
 u'2BR02B',
 u'Petrified Ants',
 u'God Bless You, Mr. Rosewater',
 u'While Mortals Sleep',
 u'Hocus Pocus',
 u'Letters',
 u'Timequake',
 u'Player Piano',
 u'Look at the Birdie',
 u'Bagombo Snuff Box']
In [99]:
tfidfDict["Timequake"][0]
Out[99]:
[[u'chapter', 1.4155934765219267],
 [u'dedication', 0.445258163631901],
 [u'contents', 0.445258163631901],
 [u'copyright', 0.3822447835809969],
 [u'title', 0.29894562613789194],
 [u'table', 0.2823709391566233]]
In [100]:
for key in tfidfDict:
    if key == "If This Isn't Nice, What Is":
        title = "If This Isn't Nice, What Is?"
    elif key == 'Man without a Country, A':
        title = 'A Man without a Country'
    elif key == 'Sirens of Titan, The':
        title = 'The Sirens of Titan'
    else:
        title = key
        
    if title == '2BR02B':
        slug = 'twobrzerotwob'
    elif title == "If This Isn't Nice, What Is?":
        slug = 'if-this-isnt-nice-what-is'
    else:
        slug = title.lower().replace(' ', '-').replace(',', '').replace('.', '').replace("\'", '').encode('ascii', 'ignore')
    newDict[slug] = {
        'tfidf': tfidfDict[key],
        'sentiment': sentDict[key],
        'title': title
    }
In [101]:
newDict.keys()
Out[101]:
['letters',
 'timequake',
 'welcome-to-the-monkey-house',
 'mother-night',
 'deadeye-dick',
 'god-bless-you-dr-kevorkian',
 'we-are-what-we-pretend-to-be',
 'slaughterhouse-five',
 'the-sirens-of-titan',
 'if-this-isnt-nice-what-is',
 'galapagos',
 'bluebeard',
 'a-man-without-a-country',
 'palm-sunday',
 'while-mortals-sleep',
 'slapstick',
 'happy-birthday-wanda-june',
 'god-bless-you-mr-rosewater',
 'jailbird',
 'petrified-ants',
 'cats-cradle',
 'twobrzerotwob',
 'player-piano',
 'look-at-the-birdie',
 'hocus-pocus',
 'bagombo-snuff-box',
 'basic-training',
 'breakfast-of-champions',
 'armageddon-in-retrospect']
In [102]:
newDict['breakfast-of-champions']['tfidf'][10]
Out[102]:
[[u'nonsense', 0.08636663317025456],
 [u'flag', 0.07202565702073845],
 [u'motto', 0.06883633261051932],
 [u'continent', 0.05757775544683637],
 [u'teachers', 0.05757775544683637],
 [u'anthem', 0.05360972686129457],
 [u'wrong', 0.05360972686129457],
 [u'consisted', 0.050531884774202014],
 [u'children', 0.04929574760001893],
 [u'citizens', 0.0480171046804923],
 [u'nation', 0.0440490760949505],
 [u'country', 0.04249911173163199],
 [u'states', 0.03735241656692703],
 [u'united', 0.03735241656692703],
 [u'fairness', 0.036365514196991355],
 [u'cheat', 0.036365514196991355],
 [u'founders', 0.036365514196991355],
 [u'1492', 0.036365514196991355],
 [u'unum', 0.036365514196991355],
 [u'hocus', 0.036365514196991355],
 [u'pocus', 0.036365514196991355],
 [u'radiant', 0.036365514196991355],
 [u'dipping', 0.036365514196991355],
 [u'blackboards', 0.036365514196991355],
 [u'baroque', 0.036365514196991355],
 [u'ignored', 0.036365514196991355],
 [u'truncated', 0.036365514196991355],
 [u'crimes', 0.036365514196991355],
 [u'result', 0.036365514196991355],
 [u'closer', 0.036365514196991355],
 [u'playfulness', 0.036365514196991355],
 [u'pluribus', 0.036365514196991355],
 [u'imaginative', 0.036365514196991355],
 [u'undippable', 0.036365514196991355],
 [u'bum', 0.036365514196991355],
 [u'raising', 0.036365514196991355],
 [u'founding', 0.036365514196991355],
 [u'education', 0.036365514196991355],
 [u'beings', 0.033652223648379734],
 [u'welcomed', 0.03158518881381932],
 [u'rob', 0.03158518881381932],
 [u'pride', 0.03158518881381932],
 [u'pirates', 0.03158518881381932],
 [u'fathers', 0.03158518881381932],
 [u'mattered', 0.03158518881381932],
 [u'salute', 0.03158518881381932],
 [u'aristocrats', 0.03158518881381932],
 [u'clues', 0.03158518881381932],
 [u'study', 0.03158518881381932],
 [u'brotherhood', 0.03158518881381932],
 [u'comforted', 0.03158518881381932],
 [u'ancient', 0.03158518881381932],
 [u'insulted', 0.03158518881381932],
 [u'example', 0.03158518881381932],
 [u'memorize', 0.03158518881381932],
 [u'strength', 0.03158518881381932],
 [u'cheated', 0.03158518881381932],
 [u'lot', 0.029438316348696997],
 [u'bringing', 0.028788877723418184],
 [u'respectful', 0.028788877723418184],
 [u'poets', 0.028788877723418184],
 [u'joy', 0.028788877723418184],
 [u'studied', 0.028788877723418184],
 [u'hope', 0.026804863430647283],
 [u'concealed', 0.026804863430647283],
 [u'pyramid', 0.026804863430647283],
 [u'estate', 0.026804863430647283],
 [u'trash', 0.026804863430647283],
 [u'happiness', 0.025265942387101007],
 [u'ground', 0.025265942387101007],
 [u'friendly', 0.025265942387101007],
 [u'society', 0.025265942387101007],
 [u'sea', 0.025265942387101007],
 [u'mistake', 0.025265942387101007],
 [u'vacant', 0.025265942387101007],
 [u'innocent', 0.02400855234024615],
 [u'stick', 0.02400855234024615],
 [u'beauty', 0.02400855234024615],
 [u'evil', 0.02400855234024615],
 [u'president', 0.02400855234024615],
 [u'terrible', 0.022945444203506436],
 [u'human', 0.02292526408164858],
 [u'mentioned', 0.02202453804747525],
 [u'language', 0.02202453804747525],
 [u'millions', 0.02202453804747525],
 [u'useless', 0.02202453804747525],
 [u'wished', 0.021212241249845016],
 [u'eye', 0.020485617003928973],
 [u'spoke', 0.020485617003928973],
 [u'top', 0.020485617003928973],
 [u'simply', 0.01982830541907156],
 [u'lives', 0.01982830541907156],
 [u'kill', 0.019228226957074112],
 [u'form', 0.019228226957074112],
 [u'discovered', 0.018676208283463516],
 [u'paper', 0.018676208283463516],
 [u'weren', 0.01768930591352784],
 [u'began', 0.01724421266430321],
 [u'picture', 0.01724421266430321],
 [u'living', 0.016826111824189867],
 [u'america', 0.016826111824189867],
 [u'meant', 0.016059038478602114],
 [u'full', 0.016059038478602114],
 [u'real', 0.01570529162075694],
 [u'wrote', 0.015368807729933267],
 [u'year', 0.015368807729933267],
 [u'asked', 0.015047980035899522],
 [u'great', 0.014447901573902076],
 [u'times', 0.014447901573902076],
 [u'money', 0.013384793437162366],
 [u'kilgore', 0.013179468207274982],
 [u'knew', 0.011651590483500942],
 [u'hoover', 0.011616313927178388],
 [u'thought', 0.011099571809890347],
 [u'planet', 0.010754672357651303],
 [u'told', 0.008728733609181213],
 [u'trout', 0.007404153243713811],
 [u'dwayne', 0.0063560717681562665]]
In [103]:
with open('vonnegut.json', 'w') as outfile:
    json.dump(newDict, outfile)
In [104]:
jsonDocs = [{} for _ in range(max([len(newDict[slug]['tfidf']) for slug in newDict]))]
sentDict = {}

for slug in newDict:
    for i in range(len(newDict[slug]['tfidf'])):
        jsonDocs[i][slug] = {
            'sentiment': newDict[slug]['sentiment'][i],
            'tfidf': newDict[slug]['tfidf'][i],
            'title': newDict[slug]['title']
        }
    sentDict[slug] = newDict[slug]['sentiment']
        
In [107]:
with open('sentiment.json', 'w') as outfile:
    json.dump(sentDict, outfile)
In [108]:
jsonDocs[0]
Out[108]:
{'a-man-without-a-country': {'sentiment': 0.3875,
  'tfidf': [[u'sirens', 0.18995162126496545],
   [u'cathouse', 0.18995162126496545],
   [u'wanda', 0.18995162126496545],
   [u'rosewater', 0.18995162126496545],
   [u'monkey', 0.18995162126496545],
   [u'june', 0.18995162126496545],
   [u'canary', 0.18995162126496545],
   [u'birthday', 0.18995162126496545],
   [u'titan', 0.15694461266687282],
   [u'cat', 0.15694461266687282],
   [u'bless', 0.15694461266687282],
   [u'player', 0.15694461266687282],
   [u'cradle', 0.15694461266687282],
   [u'piano', 0.15694461266687282],
   [u'slaughterhouse', 0.13763675037600784],
   [u'night', 0.11331172067286542],
   [u'mother', 0.11331172067286542],
   [u'happy', 0.11331172067286542],
   [u'author', 0.10462974177791522],
   [u'house', 0.07576613208409065],
   [u'god', 0.0642822246166198]],
  'title': 'A Man without a Country'},
 'armageddon-in-retrospect': {'sentiment': -0.4,
  'tfidf': [[u'snuff', 0.24814223151299536],
   [u'timequake', 0.24814223151299536],
   [u'gal', 0.24814223151299536],
   [u'dick', 0.24814223151299536],
   [u'bluebeard', 0.24814223151299536],
   [u'hocus', 0.24814223151299536],
   [u'palm', 0.24814223151299536],
   [u'pagos', 0.24814223151299536],
   [u'bagombo', 0.24814223151299536],
   [u'pocus', 0.24814223151299536],
   [u'deadeye', 0.24814223151299536],
   [u'fates', 0.2134848724849981],
   [u'sunday', 0.2134848724849981],
   [u'box', 0.1932116170795899],
   [u'country', 0.14417015442900358],
   [u'worse', 0.1382810026461844],
   [u'death', 0.12389689902359535],
   [u'vonnegut', 0.12389689902359535],
   [u'kurt', 0.10951279540100632],
   [u'man', 0.05893274981708231]],
  'title': u'Armageddon In Retrospect'},
 'bagombo-snuff-box': {'sentiment': -0.009090909090909094,
  'tfidf': [[u'copyright', 0.2656156553196073],
   [u'llc', 0.17707710354640485],
   [u'2011', 0.17707710354640485],
   [u'rosettabooks', 0.17707710354640485],
   [u'electronic', 0.1560726435294368],
   [u'vonnegut', 0.1560726435294368],
   [u'kurt', 0.1560726435294368],
   [u'edition', 0.14378582207161364],
   [u'snuff', 0.11811012933260748],
   [u'fiction', 0.11049454059682244],
   [u'bagombo', 0.10177690203767756],
   [u'box', 0.0894900805798544],
   [u'reserved', 0.08853855177320243],
   [u'resemblance', 0.08853855177320243],
   [u'establishments', 0.08853855177320243],
   [u'embodied', 0.08853855177320243],
   [u'fictitiously', 0.08853855177320243],
   [u'reproduced', 0.08853855177320243],
   [u'uncollected', 0.08853855177320243],
   [u'entirely', 0.08853855177320243],
   [u'locales', 0.08853855177320243],
   [u'articles', 0.08853855177320243],
   [u'1999', 0.08853855177320243],
   [u'reviews', 0.08853855177320243],
   [u'quotations', 0.08853855177320243],
   [u'rights', 0.0780363217647184],
   [u'events', 0.0780363217647184],
   [u'coincidental', 0.0780363217647184],
   [u'whatsoever', 0.0780363217647184],
   [u'actual', 0.0780363217647184],
   [u'critical', 0.0780363217647184],
   [u'manner', 0.0780363217647184],
   [u'characters', 0.07189291103580682],
   [u'incidents', 0.07189291103580682],
   [u'product', 0.06753409175623439],
   [u'published', 0.06753409175623439],
   [u'author', 0.06415312885753424],
   [u'permission', 0.06415312885753424],
   [u'imagination', 0.06415312885753424],
   [u'cover', 0.0613906810273228],
   [u'art', 0.05905506466630374],
   [u'written', 0.05524727029841122],
   [u'names', 0.053650898849050215],
   [u'places', 0.05088845101883878],
   [u'short', 0.04855283465781972],
   [u'case', 0.043148668840566194],
   [u'person', 0.043148668840566194],
   [u'york', 0.04240942392890813],
   [u'book', 0.04170457520716733],
   [u'living', 0.0380506046493357],
   [u'dead', 0.03700525811165461],
   [u'business', 0.03190719392042411],
   [u'work', 0.029571577559405048]],
  'title': u'Bagombo Snuff Box'},
 'basic-training': {'sentiment': 0.04545454545454545,
  'tfidf': [[u'electronic', 0.23933904279385645],
   [u'copyright', 0.23933904279385645],
   [u'2012', 0.23933904279385645],
   [u'edition', 0.159559361862571],
   [u'llc', 0.159559361862571],
   [u'vonnegut', 0.159559361862571],
   [u'rosettabooks', 0.159559361862571],
   [u'passages', 0.0797796809312855],
   [u'photo', 0.0797796809312855],
   [u'reviewer', 0.0797796809312855],
   [u'reserved', 0.0797796809312855],
   [u'review', 0.0797796809312855],
   [u'storage', 0.0797796809312855],
   [u'writing', 0.0797796809312855],
   [u'systems', 0.0797796809312855],
   [u'basic', 0.0797796809312855],
   [u'reproduced', 0.0797796809312855],
   [u'quote', 0.0797796809312855],
   [u'published', 0.0797796809312855],
   [u'jr', 0.0797796809312855],
   [u'courtesy', 0.0797796809312855],
   [u'nanny', 0.0797796809312855],
   [u'publisher', 0.0797796809312855],
   [u'rights', 0.0797796809312855],
   [u'cover', 0.0797796809312855],
   [u'kurt', 0.0797796809312855],
   [u'retrieval', 0.0797796809312855],
   [u'art', 0.06591673732008659],
   [u'including', 0.06591673732008659],
   [u'contents', 0.06591673732008659],
   [u'book', 0.06591673732008659],
   [u'permission', 0.06591673732008659],
   [u'iii', 0.06591673732008659],
   [u'training', 0.06591673732008659],
   [u'jacket', 0.06591673732008659],
   [u'mechanical', 0.06591673732008659],
   [u'york', 0.06591673732008659],
   [u'ii', 0.05780743515792329],
   [u'form', 0.05780743515792329],
   [u'trust', 0.05205379370888768]],
  'title': u'Basic Training'},
 'bluebeard': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.3302002330461243],
   [u'monthly', 0.16510011652306214],
   [u'review', 0.16510011652306214],
   [u'humorist', 0.16510011652306214],
   [u'lessing', 0.16510011652306214],
   [u'unimitative', 0.16510011652306214],
   [u'inimitable', 0.16510011652306214],
   [u'unique', 0.16510011652306214],
   [u'harper', 0.16510011652306214],
   [u'landscapes', 0.16510011652306214],
   [u'doris', 0.16510011652306214],
   [u'celebration', 0.14343926713056385],
   [u'defense', 0.1307684825021837],
   [u'map', 0.1307684825021837],
   [u'kurt', 0.1307684825021837],
   [u'finest', 0.12177841773806557],
   [u'laugh', 0.1148051817594965],
   [u'vonnegut', 0.10910763310968542],
   [u'atlantic', 0.10910763310968542],
   [u'social', 0.10910763310968542],
   [u'writers', 0.1042904243650836],
   [u'names', 0.09643684848130528],
   [u'places', 0.09643684848130528],
   [u'america', 0.0931443323669982],
   [u'magazine', 0.0931443323669982],
   [u'greatest', 0.08494544910238912],
   [u'black', 0.08047354773861808],
   [u'times', 0.06578593432468884],
   [u'book', 0.06328459970989082],
   [u'best', 0.05679586956057069],
   [u'york', 0.049050989438552524]],
  'title': u'Bluebeard'},
 'breakfast-of-champions': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.3295624724102342],
   [u'finest', 0.1647812362051171],
   [u'review', 0.1647812362051171],
   [u'humorist', 0.1647812362051171],
   [u'lessing', 0.1647812362051171],
   [u'unimitative', 0.1647812362051171],
   [u'atlantic', 0.1647812362051171],
   [u'vommegut', 0.1647812362051171],
   [u'inimitable', 0.1647812362051171],
   [u'unique', 0.1647812362051171],
   [u'landscapes', 0.1647812362051171],
   [u'doris', 0.1647812362051171],
   [u'defense', 0.1431203868126188],
   [u'monthly', 0.1431203868126188],
   [u'celebration', 0.1431203868126188],
   [u'harper', 0.1431203868126188],
   [u'map', 0.13044960218423865],
   [u'laugh', 0.1214595374201205],
   [u'social', 0.1214595374201205],
   [u'kurt', 0.1214595374201205],
   [u'writers', 0.11448630144155145],
   [u'names', 0.10878875279174037],
   [u'greatest', 0.10878875279174037],
   [u'magazine', 0.10397154404713854],
   [u'places', 0.09979868802762222],
   [u'best', 0.08462656878444406],
   [u'america', 0.07624331920336033],
   [u'york', 0.07445711877086193],
   [u'times', 0.06546705400674378],
   [u'book', 0.052796269378363646],
   [u'black', 0.03955207416660237]],
  'title': u'Breakfast of Champions'},
 'cats-cradle': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.32516339738994626],
   [u'finest', 0.16258169869497313],
   [u'monthly', 0.16258169869497313],
   [u'review', 0.16258169869497313],
   [u'humorist', 0.16258169869497313],
   [u'map', 0.16258169869497313],
   [u'lessing', 0.16258169869497313],
   [u'unimitative', 0.16258169869497313],
   [u'atlantic', 0.16258169869497313],
   [u'inimitable', 0.16258169869497313],
   [u'unique', 0.16258169869497313],
   [u'harper', 0.16258169869497313],
   [u'landscapes', 0.16258169869497313],
   [u'doris', 0.16258169869497313],
   [u'defense', 0.14277749353611754],
   [u'social', 0.14277749353611754],
   [u'times', 0.13682986218969895],
   [u'vonnegut', 0.1311927761615986],
   [u'kurt', 0.1311927761615986],
   [u'chicago', 0.122973288377262],
   [u'celebration', 0.122973288377262],
   [u'magazine', 0.122973288377262],
   [u'names', 0.11659775833971313],
   [u'writers', 0.11659775833971313],
   [u'greatest', 0.11659775833971313],
   [u'laugh', 0.111388571002743],
   [u'america', 0.10698426586482135],
   [u'sun', 0.10316908321840641],
   [u'york', 0.09407040518644828],
   [u'places', 0.09158436584388743],
   [u'black', 0.08336487805955083],
   [u'best', 0.08163274600765269],
   [u'book', 0.05381991327296401]],
  'title': u"Cat's Cradle"},
 'deadeye-dick': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.329241134941458],
   [u'monthly', 0.164620567470729],
   [u'review', 0.164620567470729],
   [u'lessing', 0.164620567470729],
   [u'unimitative', 0.164620567470729],
   [u'atlantic', 0.164620567470729],
   [u'inimitable', 0.164620567470729],
   [u'harper', 0.164620567470729],
   [u'landscapes', 0.164620567470729],
   [u'doris', 0.164620567470729],
   [u'writers', 0.1429597180782307],
   [u'humorist', 0.1429597180782307],
   [u'finest', 0.13028893344985057],
   [u'map', 0.13028893344985057],
   [u'unique', 0.13028893344985057],
   [u'celebration', 0.13028893344985057],
   [u'defense', 0.12129886868573242],
   [u'laugh', 0.12129886868573242],
   [u'vonnegut', 0.12129886868573242],
   [u'magazine', 0.12129886868573242],
   [u'kurt', 0.12129886868573242],
   [u'names', 0.11432563270716337],
   [u'places', 0.11432563270716337],
   [u'greatest', 0.11432563270716337],
   [u'america', 0.09595729942897215],
   [u'social', 0.09595729942897215],
   [u'book', 0.086967234664854],
   [u'best', 0.08215002592025217],
   [u'black', 0.06802549080328163],
   [u'times', 0.06403069794359774],
   [u'york', 0.06280505065755769]],
  'title': u'Deadeye Dick'},
 'galapagos': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.35419299565863877],
   [u'monthly', 0.17709649782931938],
   [u'review', 0.17709649782931938],
   [u'humorist', 0.17709649782931938],
   [u'map', 0.17709649782931938],
   [u'lessing', 0.17709649782931938],
   [u'unimitative', 0.17709649782931938],
   [u'inimitable', 0.17709649782931938],
   [u'landscapes', 0.17709649782931938],
   [u'doris', 0.15319487091345918],
   [u'defense', 0.13921331546145352],
   [u'writers', 0.13921331546145352],
   [u'unique', 0.13921331546145352],
   [u'finest', 0.129293243997599],
   [u'social', 0.129293243997599],
   [u'kurt', 0.129293243997599],
   [u'atlantic', 0.12159863877986764],
   [u'vonnegut', 0.10999614786189478],
   [u'places', 0.10539161708173882],
   [u'book', 0.10539161708173882],
   [u'black', 0.10133013309358767],
   [u'america', 0.09769701186400745],
   [u'greatest', 0.09441045393972038],
   [u'laugh', 0.09141006162973314],
   [u'names', 0.08609452094603459],
   [u'york', 0.07556411923737315],
   [u'times', 0.07556411923737315],
   [u'best', 0.06474834134581998]],
  'title': u'Galapagos'},
 'god-bless-you-dr-kevorkian': {'sentiment': -0.03571428571428567,
  'tfidf': [[u'distributed', 0.1329835321641421],
   [u'canada', 0.10469181050863414],
   [u'encouraging', 0.06649176608207105],
   [u'street', 0.06649176608207105],
   [u'reserved', 0.06649176608207105],
   [u'group', 0.06649176608207105],
   [u'140', 0.06649176608207105],
   [u'ny', 0.06649176608207105],
   [u'turnaround', 0.06649176608207105],
   [u'editor', 0.06649176608207105],
   [u'digging', 0.06649176608207105],
   [u'desk', 0.06649176608207105],
   [u'10013', 0.06649176608207105],
   [u'goldensohn', 0.06649176608207105],
   [u'roving', 0.06649176608207105],
   [u'marty', 0.06649176608207105],
   [u'buck', 0.06649176608207105],
   [u'watts', 0.06649176608207105],
   [u'pay', 0.06649176608207105],
   [u'served', 0.06649176608207105],
   [u'press', 0.05234590525431707],
   [u'special', 0.05234590525431707],
   [u'city', 0.05234590525431707],
   [u'story', 0.05234590525431707],
   [u'copyright', 0.05234590525431707],
   [u'beat', 0.05234590525431707],
   [u'sevenstories', 0.05234590525431707],
   [u'publishers', 0.05234590525431707],
   [u'bad', 0.05234590525431707],
   [u'stories', 0.05234590525431707],
   [u'london', 0.044071107129660655],
   [u'2010', 0.044071107129660655],
   [u'foreword', 0.044071107129660655],
   [u'public', 0.044071107129660655],
   [u'rights', 0.044071107129660655],
   [u'1999', 0.044071107129660655],
   [u'radio', 0.044071107129660655],
   [u'neil', 0.03364609439974248],
   [u'gaiman', 0.03364609439974248],
   [u'newyork', 0.02992524630190667],
   [u'word', 0.02992524630190667],
   [u'reporter', 0.026779314060534052],
   [u'afterlife', 0.021650448177250255],
   [u'wnyc', 0.015779385474152686],
   [u'heaven', 0.01263345323278007],
   [u'kurt', 0.01122543544733208],
   [u'vonnegut', 0.008671085591127874]],
  'title': u'God Bless You, Dr. Kevorkian'},
 'god-bless-you-mr-rosewater': {'sentiment': 0.0,
  'tfidf': [[u'chapter', 1.8075279666207806],
   [u'epigraph', 0.4613794377485297],
   [u'contents', 0.4613794377485297],
   [u'praise', 0.39836605769762556],
   [u'dedication', 0.39836605769762556],
   [u'title', 0.36150559332415616],
   [u'table', 0.2616317488997825]],
  'title': u'God Bless You, Mr. Rosewater'},
 'happy-birthday-wanda-june': {'sentiment': 0.17750000000000005,
  'tfidf': [[u'wars', 0.11637084432431301],
   [u'animals', 0.09506175753654196],
   [u'darkness', 0.09082172133203138],
   [u'killed', 0.08139230021323686],
   [u'men', 0.07284056114055507],
   [u'bars', 0.06624527309890005],
   [u'furnished', 0.06624527309890005],
   [u'climax', 0.06624527309890005],
   [u'bedrooms', 0.06624527309890005],
   [u'singing', 0.06624527309890005],
   [u'materializes', 0.06624527309890005],
   [u'row', 0.06624527309890005],
   [u'skyline', 0.06624527309890005],
   [u'thousands', 0.06624527309890005],
   [u'vonnegut', 0.06624527309890005],
   [u'singer', 0.06624527309890005],
   [u'chillun', 0.06624527309890005],
   [u'glow', 0.06624527309890005],
   [u'motionless', 0.06624527309890005],
   [u'sorts', 0.06624527309890005],
   [u'windows', 0.06624527309890005],
   [u'densely', 0.06624527309890005],
   [u'leading', 0.06624527309890005],
   [u'kurt', 0.06624527309890005],
   [u'shoes', 0.058185422162156504],
   [u'trophies', 0.058185422162156504],
   [u'blackness', 0.058185422162156504],
   [u'early', 0.058185422162156504],
   [u'minded', 0.058185422162156504],
   [u'hunts', 0.058185422162156504],
   [u'facing', 0.058185422162156504],
   [u'professional', 0.058185422162156504],
   [u'ryan', 0.05499741805419071],
   [u'pitch', 0.053470711602759236],
   [u'sport', 0.053470711602759236],
   [u'stand', 0.053470711602759236],
   [u'animal', 0.053470711602759236],
   [u'suite', 0.053470711602759236],
   [u'rich', 0.053470711602759236],
   [u'enjoy', 0.05012557122541295],
   [u'simple', 0.05012557122541295],
   [u'evening', 0.05012557122541295],
   [u'kitchen', 0.05012557122541295],
   [u'soldier', 0.05012557122541295],
   [u'sounds', 0.04753087876827098],
   [u'city', 0.04753087876827098],
   [u'corridor', 0.04753087876827098],
   [u'fighting', 0.04753087876827098],
   [u'door', 0.04556799693539619],
   [u'eyes', 0.04541086066601569],
   [u'killing', 0.04541086066601569],
   [u'husband', 0.04541086066601569],
   [u'happy', 0.04541086066601569],
   [u'master', 0.04361841090058245],
   [u'play', 0.0420657202886694],
   [u'jungle', 0.0420657202886694],
   [u'lights', 0.04069615010661843],
   [u'birthday', 0.04069615010661843],
   [u'apartment', 0.03947102783152743],
   [u'bedroom', 0.038362769926825975],
   [u'heard', 0.038362769926825975],
   [u'living', 0.038362769926825975],
   [u'audience', 0.038362769926825975],
   [u'silence', 0.03735100972927214],
   [u'scene', 0.03475631727213017],
   [u'june', 0.03330093188894405],
   [u'wanda', 0.03330093188894405],
   [u'god', 0.03200761055045307],
   [u'room', 0.03200761055045307],
   [u'front', 0.03141117689478388],
   [u'man', 0.0252410809522005],
   [u'penelope', 0.02147752749491656],
   [u'looseleaf', 0.01684416563320983],
   [u'woodly', 0.012353075561346148],
   [u'harold', 0.008137035400457942]],
  'title': u'Happy Birthday, Wanda June'},
 'hocus-pocus': {'sentiment': 0.0,
  'tfidf': [[u'chapter', 1.962170323957334],
   [u'copyright', 0.426902231750596],
   [u'dedication', 0.426902231750596],
   [u'contents', 0.3638888516996918],
   [u'title', 0.343603074307491],
   [u'table', 0.24372922988311735]],
  'title': u'Hocus Pocus'},
 'if-this-isnt-nice-what-is': {'sentiment': 0.28727272727272724,
  'tfidf': [[u'copyright', 0.32620299551245757],
   [u'2013', 0.24465224663434318],
   [u'electronic', 0.20306341580074644],
   [u'llc', 0.16310149775622879],
   [u'rosettabooks', 0.16310149775622879],
   [u'edition', 0.135375610533831],
   [u'passages', 0.08155074887811439],
   [u'reviewer', 0.08155074887811439],
   [u'reserved', 0.08155074887811439],
   [u'review', 0.08155074887811439],
   [u'storage', 0.08155074887811439],
   [u'systems', 0.08155074887811439],
   [u'permission', 0.08155074887811439],
   [u'jr', 0.08155074887811439],
   [u'publisher', 0.08155074887811439],
   [u'retrieval', 0.08155074887811439],
   [u'kurt', 0.07992383608903535],
   [u'nice', 0.07521251466278],
   [u'reproduced', 0.0676878052669155],
   [u'wakefield', 0.0676878052669155],
   [u'mechanical', 0.0676878052669155],
   [u'introduction', 0.0595785031047522],
   [u'form', 0.0595785031047522],
   [u'published', 0.0595785031047522],
   [u'cover', 0.0595785031047522],
   [u'trust', 0.05382486165571658],
   [u'dan', 0.05382486165571658],
   [u'quote', 0.04936199062943238],
   [u'writing', 0.045715559493553284],
   [u'vonnegut', 0.04327220681406914],
   [u'art', 0.04263254589700813],
   [u'including', 0.04263254589700813],
   [u'book', 0.04263254589700813],
   [u'rights', 0.04263254589700813],
   [u'advice', 0.03996191804451767],
   [u'young', 0.030251761728883657],
   [u'york', 0.030251761728883657]],
  'title': "If This Isn't Nice, What Is?"},
 'jailbird': {'sentiment': 0.2606060606060606,
  'tfidf': [[u'satirist', 0.340851853466967],
   [u'humorist', 0.1704259267334835],
   [u'map', 0.1704259267334835],
   [u'lessing', 0.1704259267334835],
   [u'unimitative', 0.1704259267334835],
   [u'inimitable', 0.1704259267334835],
   [u'unique', 0.1704259267334835],
   [u'harper', 0.1704259267334835],
   [u'landscapes', 0.1704259267334835],
   [u'review', 0.14806634026380783],
   [u'monthly', 0.13498682064741543],
   [u'atlantic', 0.13498682064741543],
   [u'kurt', 0.13498682064741543],
   [u'writers', 0.12570675379413218],
   [u'greatest', 0.12570675379413218],
   [u'finest', 0.11850857471948026],
   [u'vonnegut', 0.11850857471948026],
   [u'places', 0.11850857471948026],
   [u'magazine', 0.11262723417773979],
   [u'doris', 0.11262723417773979],
   [u'defense', 0.10765463160266693],
   [u'social', 0.10334716732445653],
   [u'names', 0.0961489882498046],
   [u'laugh', 0.09307446632063283],
   [u'america', 0.0830694686334122],
   [u'book', 0.07718812809167173],
   [u'best', 0.07378940178012895],
   [u'black', 0.06928095202609157],
   [u'york', 0.05763536023456478],
   [u'times', 0.05224651879381748]],
  'title': u'Jailbird'},
 'letters': {'sentiment': -0.2803545660688518,
  'tfidf': [[u'faber', 0.18061098986172208],
   [u'random', 0.16876757708362827],
   [u'copyright', 0.1393829047726547],
   [u'courtesy', 0.1393829047726547],
   [u'division', 0.118768862228121],
   [u'limited', 0.09246156590022854],
   [u'permission', 0.06831132455951737],
   [u'curtis', 0.06772912119814578],
   [u'alfred', 0.06772912119814578],
   [u'house', 0.06715429400679555],
   [u'group', 0.0652062300490496],
   [u'reprinted', 0.05547693954013712],
   [u'brown', 0.04774667358593698],
   [u'trademark', 0.04515274746543052],
   [u'jonathan', 0.04515274746543052],
   [u'controlled', 0.04515274746543052],
   [u'penguin', 0.04515274746543052],
   [u'knopf', 0.044538323335545374],
   [u'rights', 0.040986794735710416],
   [u'jr', 0.03943867686838248],
   [u'auden', 0.036984626360091415],
   [u'library', 0.03549449192792833],
   [u'dated', 0.03484572619316367],
   [u'usa', 0.03484572619316367],
   [u'1964', 0.03484572619316367],
   [u'photo', 0.03318666633209148],
   [u'renewed', 0.03318666633209148],
   [u'1992', 0.03183111572395799],
   [u'putnam', 0.03183111572395799],
   [u'wilson', 0.03183111572395799],
   [u'trust', 0.030685014015205143],
   [u'delacorte', 0.02969221555703025],
   [u'sons', 0.026677605087824567],
   [u'press', 0.02553150337907172],
   [u'vonnegut', 0.024761032491090722],
   [u'united', 0.02453870492089683],
   [u'cataloging', 0.02257637373271526],
   [u'kingdom', 0.02257637373271526],
   [u'brunswick', 0.02257637373271526],
   [u'excerpt', 0.02257637373271526],
   [u'origami', 0.02257637373271526],
   [u'acknowledgment', 0.02257637373271526],
   [u'kidwell', 0.02257637373271526],
   [u'illustrations', 0.02257637373271526],
   [u'leif', 0.02257637373271526],
   [u'foreword', 0.02257637373271526],
   [u'unc', 0.02257637373271526],
   [u'hawkins', 0.02257637373271526],
   [u'berg', 0.02257637373271526],
   [u'getty', 0.02257637373271526],
   [u'associates', 0.02257637373271526],
   [u'colophon', 0.02257637373271526],
   [u'corbis', 0.02257637373271526],
   [u'hammarskjold', 0.02257637373271526],
   [u'data', 0.02257637373271526],
   [u'sj', 0.02257637373271526],
   [u'2008', 0.02257637373271526],
   [u'dell', 0.02184052281168219],
   [u'16', 0.0206483841494132],
   [u'member', 0.020377992742938295],
   [u'imprint', 0.01999961841464855],
   [u'maine', 0.01999961841464855],
   [u'2012', 0.01999961841464855],
   [u'markings', 0.01999961841464855],
   [u'reprint', 0.01999961841464855],
   [u'insert', 0.01999961841464855],
   [u'bowdoin', 0.01999961841464855],
   [u'images', 0.01999961841464855],
   [u'mendelson', 0.01999961841464855],
   [u'electronic', 0.01999961841464855],
   [u'buck', 0.01999961841464855],
   [u'historical', 0.01999961841464855],
   [u'dag', 0.01999961841464855],
   [u'collection', 0.019621244086358798],
   [u'lilly', 0.018492313180045707],
   [u'canada', 0.018492313180045707],
   [u'credits', 0.018492313180045707],
   [u'squibb', 0.018492313180045707],
   [u'archives', 0.018492313180045707],
   [u'registered', 0.018492313180045707],
   [u'translation', 0.018492313180045707],
   [u'translated', 0.017422863096581837],
   [u'armageddon', 0.017422863096581837],
   [u'retrospect', 0.017422863096581837],
   [u'reserved', 0.017422863096581837],
   [u'rackstraw', 0.017422863096581837],
   [u'cape', 0.01685042412141327],
   [u'edward', 0.01659333316604574],
   [u'chapel', 0.01659333316604574],
   [u'drake', 0.01659333316604574],
   [u'ginsberg', 0.01659333316604574],
   [u'congress', 0.01659333316604574],
   [u'hill', 0.015915557861978995],
   [u'pfc', 0.015915557861978995],
   [u'southern', 0.015915557861978995],
   [u'loree', 0.015915557861978995],
   [u'grateful', 0.015342507007602571],
   [u'1945', 0.015342507007602571],
   [u'material', 0.015342507007602571],
   [u'wakefield', 0.015342507007602571],
   [u'1981', 0.014846107778515125],
   [u'allen', 0.014846107778515125],
   [u'papers', 0.014846107778515125],
   [u'express', 0.014846107778515125],
   [u'otis', 0.014408252627376154],
   [u'charles', 0.014408252627376154],
   [u'publication', 0.01401657784797903],
   [u'published', 0.013780942965979912],
   [u'dan', 0.013662264911903473],
   [u'alex', 0.013338802543912284],
   [u'13', 0.01304124600980992],
   [u'godwin', 0.01304124600980992],
   [u'palm', 0.01276575168953586],
   [u'publishing', 0.012509272613376187],
   [u'states', 0.012509272613376187],
   [u'pictures', 0.012269352460448415],
   [u'edie', 0.012269352460448415],
   [u'gail', 0.012269352460448415],
   [u'richard', 0.012043982119123378],
   [u'10', 0.012043982119123378],
   [u'15', 0.012043982119123378],
   [u'17', 0.012043982119123378],
   [u'books', 0.011863997915406679],
   [u'29', 0.011831497309309442],
   [u'18', 0.011831497309309442],
   [u'jerome', 0.011258446454933018],
   [u'farber', 0.011258446454933018],
   [u'14', 0.011085509593836761],
   [u'klinkowitz', 0.010762047225845573],
   [u'1973', 0.010762047225845573],
   [u'12', 0.010762047225845573],
   [u'sunday', 0.0103241920747066],
   [u'letter', 0.009810069464639703],
   [u'11', 0.009692597142381703],
   [u'john', 0.00925474199124273],
   [u'nanny', 0.008863067211845608],
   [u'college', 0.00859421716879867],
   [u'kurt', 0.0083642667195408],
   [u'november', 0.007612241053402437],
   [u'family', 0.0071158418243149925],
   [u'burger', 0.0067827111228663415],
   [u'life', 0.0051706814385731785],
   [u'book', 0.0034407065326652483],
   [u'time', 0.002917388488497656],
   [u'york', 0.002065396422437536]],
  'title': u'Letters'},
 'look-at-the-birdie': {'sentiment': 0.0,
  'tfidf': [[u'cat', 0.42532458272900797],
   [u'retrospect', 0.2649771622534616],
   [u'deadeye', 0.2649771622534616],
   [u'champions', 0.2649771622534616],
   [u'dick', 0.2649771622534616],
   [u'timbuktu', 0.2649771622534616],
   [u'canary', 0.2649771622534616],
   [u'armageddon', 0.2649771622534616],
   [u'snuff', 0.23197015365536897],
   [u'bluebeard', 0.23197015365536897],
   [u'bagombo', 0.23197015365536897],
   [u'cradle', 0.18833726166136158],
   [u'country', 0.17965528276641135],
   [u'breakfast', 0.17231477420320856],
   [u'kurt', 0.16034742047554637],
   [u'vonnegut', 0.15533025306326895],
   [u'box', 0.14283671666005507],
   [u'house', 0.08587239483948243],
   [u'time', 0.05513338857421144],
   [u'man', 0.045209518594354]],
  'title': u'Look at the Birdie'},
 'mother-night': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.3047109407494808],
   [u'finest', 0.1523554703747404],
   [u'conjuring', 0.1523554703747404],
   [u'monthly', 0.1523554703747404],
   [u'medicine', 0.1523554703747404],
   [u'humorist', 0.1523554703747404],
   [u'lessing', 0.1523554703747404],
   [u'unimitative', 0.1523554703747404],
   [u'warn', 0.1523554703747404],
   [u'atlantic', 0.1523554703747404],
   [u'inimitable', 0.1523554703747404],
   [u'unique', 0.1523554703747404],
   [u'harper', 0.1523554703747404],
   [u'social', 0.1523554703747404],
   [u'landscapes', 0.1523554703747404],
   [u'doris', 0.1523554703747404],
   [u'fantasies', 0.13310138202585303],
   [u'writers', 0.13310138202585303],
   [u'map', 0.13310138202585303],
   [u'review', 0.12183846235618181],
   [u'laugh', 0.11384729367696567],
   [u'places', 0.11384729367696567],
   [u'defense', 0.1076488616960154],
   [u'vonnegut', 0.1076488616960154],
   [u'greatest', 0.10258437400729445],
   [u'kurt', 0.10258437400729445],
   [u'names', 0.08839477334712803],
   [u'magazine', 0.08574726835256345],
   [u'america', 0.0736550997065122],
   [u'book', 0.07206736598873584],
   [u'best', 0.07056549873122818],
   [u'york', 0.06914068499824066],
   [u'times', 0.06914068499824066],
   [u'black', 0.0640761973095197],
   [u'man', 0.02767112677106986]],
  'title': u'Mother Night'},
 'palm-sunday': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.29947810955816934],
   [u'map', 0.17139990417158296],
   [u'unimitative', 0.17139990417158296],
   [u'inimitable', 0.17139990417158296],
   [u'landscapes', 0.17139990417158296],
   [u'monthly', 0.14973905477908467],
   [u'lessing', 0.14973905477908467],
   [u'atlantic', 0.14973905477908467],
   [u'harper', 0.14973905477908467],
   [u'doris', 0.14973905477908467],
   [u'defense', 0.13706827015070455],
   [u'unique', 0.13706827015070455],
   [u'places', 0.13706827015070455],
   [u'celebration', 0.12807820538658637],
   [u'finest', 0.12110496940801734],
   [u'names', 0.12110496940801734],
   [u'humorist', 0.11540742075820626],
   [u'greatest', 0.11059021201360443],
   [u'review', 0.09646567689663389],
   [u'magazine', 0.09646567689663389],
   [u'laugh', 0.09374657136570796],
   [u'black', 0.09374657136570796],
   [u'social', 0.0847565066015898],
   [u'kurt', 0.0748048275041356],
   [u'america', 0.06726851322860784],
   [u'best', 0.059414937344829534],
   [u'writers', 0.05855871940145095],
   [u'times', 0.05772533668013341],
   [u'york', 0.052441701366260474],
   [u'book', 0.043451636602142324],
   [u'vonnegut', 0.038634427857540496]],
  'title': u'Palm Sunday'},
 'petrified-ants': {'sentiment': 0.375,
  'tfidf': [[u'foreword', 0.27663238319570327],
   [u'copyright', 0.13831619159785163],
   [u'title', 0.13831619159785163],
   [u'cover', 0.13831619159785163],
   [u'2010', 0.13831619159785163],
   [u'v5', 0.13831619159785163],
   [u'cognizant', 0.13831619159785163],
   [u'release', 0.13831619159785163],
   [u'epilogue', 0.13831619159785163],
   [u'original', 0.13831619159785163],
   [u'contents', 0.13831619159785163],
   [u'04', 0.13831619159785163],
   [u'october', 0.11446530288560666],
   [u'petrified', 0.0975428280355019],
   [u'author', 0.0975428280355019],
   [u'ants', 0.028210181191875662]],
  'title': u'Petrified Ants'},
 'player-piano': {'sentiment': 0.129040404040404,
  'tfidf': [[u'humorist', 0.22533063546379106],
   [u'satirist', 0.19917413808417048],
   [u'vonnegut', 0.18387356796688123],
   [u'comic', 0.11266531773189553],
   [u'dilemma', 0.11266531773189553],
   [u'orwell', 0.11266531773189553],
   [u'caligari', 0.11266531773189553],
   [u'americas', 0.11266531773189553],
   [u'review', 0.11266531773189553],
   [u'disposed', 0.11266531773189553],
   [u'literary', 0.11266531773189553],
   [u'zany', 0.11266531773189553],
   [u'fantasist', 0.11266531773189553],
   [u'finest', 0.11266531773189553],
   [u'compounded', 0.11266531773189553],
   [u'lessing', 0.11266531773189553],
   [u'gordon', 0.11266531773189553],
   [u'landscapes', 0.11266531773189553],
   [u'doris', 0.11266531773189553],
   [u'map', 0.09958706904208524],
   [u'unique', 0.09958706904208524],
   [u'black', 0.09826286829449013],
   [u'writer', 0.09193678398344061],
   [u'scientist', 0.09193678398344061],
   [u'moral', 0.09193678398344061],
   [u'dr', 0.09193678398344061],
   [u'places', 0.09193678398344061],
   [u'kurt', 0.09193678398344061],
   [u'flash', 0.08650882035227495],
   [u'defense', 0.08650882035227495],
   [u'george', 0.08229856466710116],
   [u'writers', 0.08229856466710116],
   [u'reflection', 0.0759500319006632],
   [u'greatest', 0.0759500319006632],
   [u'laugh', 0.07343057166246465],
   [u'mad', 0.07343057166246465],
   [u'controls', 0.07120825023498571],
   [u'names', 0.06922031597729088],
   [u'york', 0.06578028660382004],
   [u'deep', 0.05614206728748059],
   [u'book', 0.05614206728748059],
   [u'times', 0.05350504950681721],
   [u'best', 0.051931811602306824],
   [u'human', 0.050479716486530816],
   [u'time', 0.04343321789378964],
   [u'machine', 0.040841497170191365],
   [u'life', 0.03390329377160048],
   [u'man', 0.01609939674290014]],
  'title': u'Player Piano'},
 'slapstick': {'sentiment': 0.36742424242424243,
  'tfidf': [[u'satirist', 0.2946280504477264],
   [u'conjuring', 0.1473140252238632],
   [u'monthly', 0.1473140252238632],
   [u'review', 0.1473140252238632],
   [u'fantasies', 0.1473140252238632],
   [u'humorist', 0.1473140252238632],
   [u'lessing', 0.1473140252238632],
   [u'unimitative', 0.1473140252238632],
   [u'warn', 0.1473140252238632],
   [u'atlantic', 0.1473140252238632],
   [u'inimitable', 0.1473140252238632],
   [u'unique', 0.1473140252238632],
   [u'harper', 0.1473140252238632],
   [u'landscapes', 0.1473140252238632],
   [u'doris', 0.1473140252238632],
   [u'defense', 0.12805993687497583],
   [u'map', 0.12805993687497583],
   [u'magazine', 0.12805993687497583],
   [u'finest', 0.1167970172053046],
   [u'writers', 0.1167970172053046],
   [u'greatest', 0.1167970172053046],
   [u'places', 0.10880584852608846],
   [u'medicine', 0.09754292885641724],
   [u'kurt', 0.09754292885641724],
   [u'black', 0.09326096552788228],
   [u'vonnegut', 0.09326096552788228],
   [u'social', 0.09326096552788228],
   [u'laugh', 0.08335332819625083],
   [u'best', 0.08335332819625083],
   [u'names', 0.07828884050752986],
   [u'book', 0.07828884050752986],
   [u'america', 0.07606543196104275],
   [u'times', 0.06552405358035099],
   [u'york', 0.06145173485279889],
   [u'man', 0.04855435684915727]],
  'title': u'Slapstick'},
 'slaughterhouse-five': {'sentiment': 0.2606060606060606,
  'tfidf': [[u'satirist', 0.2787377687119402],
   [u'defense', 0.1393688843559701],
   [u'conjuring', 0.1393688843559701],
   [u'monthly', 0.1393688843559701],
   [u'fantasies', 0.1393688843559701],
   [u'map', 0.1393688843559701],
   [u'lessing', 0.1393688843559701],
   [u'unimitative', 0.1393688843559701],
   [u'warn', 0.1393688843559701],
   [u'atlantic', 0.1393688843559701],
   [u'inimitable', 0.1393688843559701],
   [u'unique', 0.1393688843559701],
   [u'harper', 0.1393688843559701],
   [u'landscapes', 0.1393688843559701],
   [u'doris', 0.1393688843559701],
   [u'finest', 0.12011479600708275],
   [u'review', 0.12011479600708275],
   [u'medicine', 0.12011479600708275],
   [u'humorist', 0.12011479600708275],
   [u'greatest', 0.12011479600708275],
   [u'social', 0.12011479600708275],
   [u'writers', 0.10885187633741152],
   [u'names', 0.10086070765819537],
   [u'magazine', 0.10086070765819537],
   [u'best', 0.0946622756772451],
   [u'vonnegut', 0.0946622756772451],
   [u'kurt', 0.0946622756772451],
   [u'laugh', 0.08959778798852415],
   [u'america', 0.08531582465998919],
   [u'places', 0.08160661930930801],
   [u'york', 0.0641452676586865],
   [u'black', 0.06066851368774189],
   [u'times', 0.06066851368774189],
   [u'book', 0.03982669162107817],
   [u'man', 0.030701578649632723]],
  'title': u'Slaughterhouse-Five'},
 'the-sirens-of-titan': {'sentiment': -0.1,
  'tfidf': [[u'praise', 0.2810200432858575],
   [u'epigraph', 0.2810200432858575],
   [u'contents', 0.2810200432858575],
   [u'rentals', 0.24636268425786026],
   [u'wirehouse', 0.22608942885245203],
   [u'hero', 0.22608942885245203],
   [u'hotcake', 0.22608942885245203],
   [u'cheers', 0.22608942885245203],
   [u'timbuktu', 0.22608942885245203],
   [u'timid', 0.22608942885245203],
   [u'title', 0.211705325229863],
   [u'preferred', 0.211705325229863],
   [u'deserter', 0.20054814766415252],
   [u'unknown', 0.20054814766415252],
   [u'table', 0.18372453583309184],
   [u'tent', 0.17704796620186572],
   [u'united', 0.14239060717386845],
   [u'letter', 0.14239060717386845],
   [u'war', 0.11096017420274973],
   [u'time', 0.054930614433405495]],
  'title': 'The Sirens of Titan'},
 'timequake': {'sentiment': 0.0,
  'tfidf': [[u'chapter', 1.4155934765219267],
   [u'dedication', 0.445258163631901],
   [u'contents', 0.445258163631901],
   [u'copyright', 0.3822447835809969],
   [u'title', 0.29894562613789194],
   [u'table', 0.2823709391566233]],
  'title': u'Timequake'},
 'twobrzerotwob': {'sentiment': 0.18333333333333335,
  'tfidf': [[u'floating', 0.20059631119275628],
   [u'press', 0.20059631119275628],
   [u'book', 0.15044723339456723],
   [u'responsibility', 0.10029815559637814],
   [u'contained', 0.10029815559637814],
   [u'accuracy', 0.10029815559637814],
   [u'2br02b', 0.07462603779786164],
   [u'heavy', 0.05014907779818907],
   [u'isbn', 0.05014907779818907],
   [u'accept', 0.05014907779818907],
   [u'currency', 0.05014907779818907],
   [u'edition', 0.05014907779818907],
   [u'reliability', 0.05014907779818907],
   [u'result', 0.05014907779818907],
   [u'motor', 0.05014907779818907],
   [u'reserved', 0.05014907779818907],
   [u'omissions', 0.05014907779818907],
   [u'errors', 0.05014907779818907],
   [u'reliance', 0.05014907779818907],
   [u'visit', 0.05014907779818907],
   [u'29', 0.05014907779818907],
   [u'1962', 0.05014907779818907],
   [u'978', 0.05014907779818907],
   [u'equipment', 0.05014907779818907],
   [u'vonnegut', 0.05014907779818907],
   [u'vehicle', 0.05014907779818907],
   [u'ensure', 0.05014907779818907],
   [u'suffered', 0.05014907779818907],
   [u'2011', 0.05014907779818907],
   [u'suitcases', 0.05014907779818907],
   [u'liability', 0.05014907779818907],
   [u'operating', 0.05014907779818907],
   [u'effort', 0.05014907779818907],
   [u'loss', 0.05014907779818907],
   [u'licensors', 0.05014907779818907],
   [u'rights', 0.05014907779818907],
   [u'assume', 0.05014907779818907],
   [u'thefloatingpress', 0.05014907779818907],
   [u'775454', 0.05014907779818907],
   [u'published', 0.05014907779818907],
   [u'kurt', 0.05014907779818907],
   [u'alike', 0.05014907779818907]],
  'title': u'2BR02B'},
 'we-are-what-we-pretend-to-be': {'sentiment': 0.0,
  'tfidf': [[u'vi', 0.34606022634275635],
   [u'title', 0.34606022634275635],
   [u'iii', 0.34606022634275635],
   [u'iv', 0.34606022634275635],
   [u'contents', 0.34606022634275635],
   [u'foreword', 0.3091997619692869],
   [u'ii', 0.2830468462918522],
   [u'basic', 0.2830468462918522],
   [u'novella', 0.2830468462918522],
   [u'training', 0.26276106889965134],
   [u'table', 0.18317300186747862]],
  'title': u'We Are What We Pretend to Be'},
 'welcome-to-the-monkey-house': {'sentiment': 0.29545454545454547,
  'tfidf': [[u'epigraph', 0.4510485519690844],
   [u'praise', 0.39772953807985784],
   [u'preface', 0.39772953807985784],
   [u'title', 0.36653991437922984],
   [u'dedication', 0.34441052419063134],
   [u'bergeron', 0.3272456356279998],
   [u'contents', 0.3132209004900033],
   [u'monkey', 0.29109151030140473],
   [u'harrison', 0.23777249641217818],
   [u'live', 0.22871226290014865],
   [u'table', 0.1920257958162787],
   [u'house', 0.13870678192705216],
   [u'time', 0.08025766230715847]],
  'title': u'Welcome to the Monkey House'},
 'while-mortals-sleep': {'sentiment': 0.0,
  'tfidf': [[u'cat', 0.3415562047464727],
   [u'canary', 0.24075366378341462],
   [u'armageddon', 0.24075366378341462],
   [u'snuff', 0.24075366378341462],
   [u'dick', 0.24075366378341462],
   [u'bluebeard', 0.24075366378341462],
   [u'bagombo', 0.24075366378341462],
   [u'deadeye', 0.24075366378341462],
   [u'retrospect', 0.24075366378341462],
   [u'champions', 0.24075366378341462],
   [u'timbuktu', 0.24075366378341462],
   [u'cradle', 0.18047999590863678],
   [u'kurt', 0.15614887469405317],
   [u'breakfast', 0.15034316197124786],
   [u'vonnegut', 0.1452221604209703],
   [u'box', 0.1452221604209703],
   [u'country', 0.14064126843584743],
   [u'illustration', 0.12923412650247826],
   [u'credit', 0.12301235069201419],
   [u'house', 0.08375723279888314],
   [u'time', 0.04559556075158248],
   [u'man', 0.04052887308828022]],
  'title': u'While Mortals Sleep'}}
In [109]:
i = 0
for doc in jsonDocs:
    with open('sections/vonnegut-%i.json' % i, 'w') as outfile:
        json.dump(doc, outfile)
    i += 1
In [110]:
for key in jsonDocs[0]:
    jsonDocs[0][key]['length'] = len(newDict[key]['tfidf'])
In [111]:
with open('vonnegut-0.json', 'w') as outfile:
    json.dump(jsonDocs[0], outfile)
In [89]:
from collections import defaultdict

sentDict = defaultdict(list)

for doc in jsonDocs:
    for slug in doc:
        sentDict[slug].append(doc[slug]['sentiment'][1])
    
In [90]:
sentDict['galapagos']
Out[90]:
[0.36742424242424243,
 -0.3125,
 0.11275252525252526,
 -0.026363636363636363,
 0.3125,
 0.2,
 0.375,
 0.23214285714285715,
 0.13333333333333333,
 0.08228260869565218,
 0.11523199023199023,
 0.08410845910845911,
 0.05010517260517261,
 0.08918246237889092,
 0.20664285714285713,
 0.09175000000000001,
 0.06503765331890332,
 0.014166666666666662,
 0.03830227743271221,
 0.07637237762237764,
 0.16008297258297252,
 0.05798059964726632,
 0.17339605734767027,
 0.09930313588850177,
 0.16925353925353925,
 0.07038477891156465,
 0.07483349983349984,
 0.12054673721340385,
 0.12696608946608948,
 0.02375283446712018,
 0.07497429041546688,
 0.050454545454545446,
 0.13068910256410254,
 -0.0004487179487179477,
 0.10006775067750678,
 0.0360479797979798,
 0.04375,
 0.0,
 0.11861111111111113,
 0.0583611111111111,
 -0.00314980158730159,
 0.1511111111111111,
 0.21727941176470586,
 0.21571914480077747,
 0.18094135802469136,
 0.08128706199460918,
 0.08433641975308642,
 0.11261446886446887,
 -0.003034547152194198,
 0.014447383891828338,
 0.1619660894660895,
 0.06781045751633988,
 0.06796536796536796,
 0.37261904761904757,
 0.13173076923076923,
 0.020866716026290495,
 0.21664965986394555,
 0.13805886243386245,
 0.08120596205962059,
 0.09489484126984128,
 0.375,
 0.20108225108225106,
 0.1720254492981766,
 0.21122211122211126,
 0.184,
 0.3,
 0.19469696969696967,
 0.029410904410904416,
 0.07555555555555556,
 0.11317919454283092,
 0.16228766588602656,
 0.058755752505752504,
 0.09012771950271949,
 0.2235227272727273,
 0.15271825396825398,
 0.06196753246753247,
 0.07186169183120403,
 0.12971288515406165,
 0.028657627095127095,
 0.04591666666666668,
 0.11057279140612476,
 0.0506790373977874,
 0.0752667430608607,
 0.03815104166666666,
 0.04967171717171717,
 0.1052445211038961,
 0.01755454794247897,
 0.06707873376623379,
 0.004497491145218425,
 0.03056318681318681,
 0.20328621031746028,
 0.1442753623188406,
 0.08445833333333333,
 0.4947321428571429,
 0.40714285714285714,
 0.020852229780801215,
 0.15059290382819793,
 0.11172513828763829,
 0.05483546401515151,
 0.03947811447811447,
 0.12438157081014224,
 0.12065335027291552,
 0.19476190476190477,
 0.1833838383838384,
 0.07547619047619049,
 0.05024509803921569,
 0.13415270429159318,
 0.19999999999999998,
 0.09881854256854257,
 0.08382207049486462,
 0.024077509791795508,
 0.1486111111111111,
 0.07189542483660132,
 0.048620750594434804,
 -0.006510416666666671,
 -0.013095238095238096,
 0.03057666328942925,
 0.10150462962962964,
 0.17103852258852253,
 0.17221811713191026,
 -0.04772727272727273,
 -0.036655643738977076,
 0.12687500000000002,
 0.038225446428571425,
 -0.015036075036075043,
 0.21788311688311687,
 0.05717592592592592,
 0.10722868217054264,
 -0.011421356421356419,
 0.20586697086697084,
 0.13618950493950496,
 0.18726807760141095,
 0.08059051398337114,
 0.05335948773448773,
 0.10824754513778906,
 0.13658506244713142,
 0.059278711484593835,
 0.08411458333333333,
 0.09283854166666666,
 0.11658385093167702,
 0.08139837819185647,
 0.125,
 0.12668707482993197,
 0.05742063492063493,
 0.06651128472222222,
 0.1687689704931084,
 0.15283882783882782,
 -0.5,
 0.12151162790697674,
 0.06447619047619049,
 0.0491331684188827,
 -0.015249042145593887,
 0.1251302083333333,
 0.1493421052631579,
 0.11614789005032906,
 0.04726406926406927,
 0.07328431372549021,
 0.15401234567901234,
 0.03885324105718844,
 0.0037698412698412755,
 0.10958646616541357,
 0.03103408029878619,
 0.048652263374485596,
 0.13903596403596402,
 0.16496598639455784,
 0.24520887842316408,
 0.08517857142857142,
 0.0662741046831956,
 -0.11785714285714285,
 -0.5]
In [91]:
with open('sentiment.json', 'w') as outfile:
    json.dump(sentDict, outfile)
In [ ]: