/NLPGameOfThrones

Fun NLP Project analyzing bigrams and trigrams of Harry Potter and Game of Thrones

Primary LanguagePythonApache License 2.0Apache-2.0

Examine the text in the documents that you chose and decide how to process the words, i.e. decide on tokenization and whether to use all lower case, stopwords or lemmatization.

Harry Potter top 50 words || Game Of Thrones top 50 words

("''", 2482) ("''", 8113) ('harry', 1314) ('lord', 1301) ('--', 788) ('jon', 830) ('ron', 429) ('ned', 785) ('hagrid', 367) ('back', 691) ('hermione', 270) ('father', 635) ('...', 268) ('tyrion', 615) ('back', 261) ('men', 575) ('professor', 180) ('eyes', 561) ('snape', 170) ('bran', 546) ('looked', 169) ('told', 502) ('dumbledore', 158) ('catelyn', 491) ('dudley', 137) ('arya', 459) (';', 135) (';', 444) ('uncle', 122) ('face', 443) ('malfoy', 121) ('boy', 439) ('vernon', 116) ('brother', 437) ('yeh', 116) ('sansa', 422) ('neville', 114) ('dany', 413) ('quirrell', 110) ('robb', 409) ('door', 106) ('looked', 405) ('eyes', 105) ('robert', 403) ('potter', 102) ('stark', 393) ('mcgonagall', 101) ('black', 390) ('head', 99) ('head', 374) ('people', 97) ('made', 361) ('thought', 96) ('night', 354) ('told', 93) ('maester', 344) ('room', 90) ('lannister', 344) ('face', 87) ('lady', 342) ('gryffindor', 86) ('thought', 336) ('boy', 85) ('sword', 335) ('good', 83) ('blood', 310) ('left', 82) ('voice', 300) ('hogwarts', 79) ('asked', 277) ('stone', 79) ('left', 268) ('turned', 77) ('dead', 265) ('house', 77) ('day', 260) ('heard', 74) ('make', 258) ('great', 72) ('knew', 251) ('suddenly', 69) ('heard', 251) ('found', 69) ('horse', 251) (':', 69) ('gods', 247) ('school', 68) ('good', 247) ('bit', 67) ('gave', 242) ('made', 66) ('great', 240) ('aunt', 65) ('winterfell', 237) ('knew', 64) ('hair', 226) ('wand', 61) ('wall', 224) ('asked', 60) ('turned', 220)

Harry Potter Top 50 Bigrams Game of Thrones Top 50 Bigrams

(('uncle', 'vernon'), 0.0032489997292500226) (('lord', 'tywin'), 0.0010171297566961043) (('professor', 'mcgonagall'),0.002857916428506964) (('maester', 'luwin'), 0.0009525500896042881) (('harry', 'ron'), 0.0016244998646250113) (('khal', 'drogo'), 0.000904115339285426) (('aunt', 'petunia'), 0.001564333202972233) (('lord', 'eddard'), 0.0008556805889665638) (('ron', 'hermione'), 0.0010829999097500076) (('night', 'watch'), 0.0007265212547829316) (('harry', 'potter'), 0.0009024999247916729) (('lord', 'father'), 0.0007023038796235005) (('harry', 'looked'), 0.0007821666014861165) (('tyrion', 'lannister'), 0.0006457966709181614) (('harry', 'felt'), 0.0006919166090069492) (('septa', 'mordane'), 0.0006054343789857763) (('professor', 'dumbledore'), 0.0006618332781805602) (('eddard', 'stark'), 0.0005166373367345292) (('common', 'room'), 0.000601666616527782) (('grand', 'maester'), 0.0005085648783480521) (('harry', 'hermione'), 0.0005715832857013928) (('lord', 'commander'), 0.0005004924199615751) (('harry', 'thought'), 0.0005715832857013928) (('lord', 'renly'), 0.0004924199615750981) (('crabbe', 'goyle'), 0.0005414999548750038) (('maester', 'pycelle'), 0.00043591275286975894) (('professor', 'quirrell'), 0.0005414999548750038) (('maz', 'duur'), 0.00041976783609680494) (('fred', 'george'), 0.0005114166240486146) (('jon', 'arryn'), 0.0004116953777103279) (('hermione', 'granger'), 0.0005114166240486146) (('jon', 'snow'), 0.0004116953777103279) (('harry', 'asked'), 0.00048133329322222555) (('mirri', 'maz'), 0.0004116953777103279) (('privet', 'drive'), 0.00048133329322222555) (('casterly', 'rock'), 0.0004036229193238509) (('professor', 'flitwick'), 0.00045124996239583645) (('catelyn', 'stark'), 0.0003713330857779428) (('harry', 'knew'), 0.00042116663156944735) (('maester', 'aemon'), 0.00035518816900498876) (('harry', 'told'), 0.00042116663156944735) (('lady', 'stark'), 0.00033097079384555774) (('invisibility', 'cloak'), 0.00042116663156944735) (('theon', 'greyjoy'), 0.00033097079384555774) (('nimbus', 'thousand'), 0.00042116663156944735) (('jaime', 'lannister'), 0.0003148258770726037) (('ron', 'harry'), 0.00042116663156944735) (('prince', 'joffrey'), 0.0003148258770726037) (('harry', 'harry'), 0.00039108330074305825) (('lord', 'stannis'), 0.00029868096029964965) (('harry', 'heard'), 0.00039108330074305825) (('grey', 'wind'), 0.0002906085019131726) (('madam', 'pomfrey'), 0.00039108330074305825) (('shook', 'head'), 0.0002744635851402186) (('nicolas', 'flamel'), 0.00039108330074305825) (('tywin', 'lannister'), 0.0002663911267537416) (('sorcerer', 'stone'), 0.00039108330074305825) (('sandor', 'clegane'), 0.00025024620998078756) (('madam', 'hooch'), 0.0003309166390902801) (('vaes', 'dothrak'), 0.00025024620998078756) (('uncle', 'vernon'), 0.0032489997292500226) (('benjen', 'stark'), 0.00024217375159431054) (('professor', 'mcgonagall'),0.002857916428506964) (('lord', 'arryn'), 0.00024217375159431054) (('harry', 'ron'), 0.0016244998646250113) (('samwell', 'tarly'), 0.00024217375159431054) (('aunt', 'petunia'), 0.001564333202972233) (('lord', 'stark'), 0.00023410129320783351) (('ron', 'hermione'), 0.0010829999097500076) (('magister', 'illyrio'), 0.00023410129320783351) (('harry', 'potter'), 0.0009024999247916729) (('gold', 'cloaks'), 0.0002260288348213565) (('harry', 'looked'), 0.0007821666014861165) (('iron', 'throne'), 0.0002260288348213565) (('harry', 'felt'), 0.0006919166090069492) (('lord', 'walder'), 0.0002260288348213565) (('professor', 'dumbledore'),0.0006618332781805602) (('free', 'cities'), 0.00021795637643487947) (('common', 'room'), 0.000601666616527782) (('ned', 'stark'), 0.00021795637643487947) (('harry', 'hermione'), 0.0005715832857013928) (('cersei', 'lannister'), 0.00020988391804840247) (('harry', 'thought'), 0.0005715832857013928) (('turned', 'back'), 0.00020988391804840247) (('crabbe', 'goyle'), 0.0005414999548750038) (('lord', 'baelish'), 0.00020181145966192545) (('professor', 'quirrell'), 0.0005414999548750038) (('jorah', 'mormont'), 0.0001856665428889714) (('fred', 'george'), 0.0005114166240486146) (('lady', 'lysa'), 0.0001856665428889714) (('hermione', 'granger'), 0.0005114166240486146) (('years', 'ago'), 0.0001856665428889714) (('harry', 'asked'), 0.00048133329322222555) (('day', 'night'), 0.00017759408450249438) (('privet', 'drive'), 0.00048133329322222555) (('lord', 'hoster'), 0.00017759408450249438) (('professor', 'flitwick'), 0.00045124996239583645) (('lord', 'husband'), 0.00017759408450249438) (('harry', 'knew'), 0.00042116663156944735) (('lord', 'varys'), 0.00017759408450249438)

• list the top 50 bigrams by their Mutual Information scores (using min frequency 5) Top 50 Bigrams Mutual Information Scores - HP Top 50 Bigrams Mutual Information Scores - GoT

(('boa', 'constrictor'), 12.69874806849538) (('helman', 'tallhart'), 14.333597969837527) (('devil', 'snare'), 12.69874806849538) (('mance', 'rayder'), 13.59663237567132) (('lily', 'james'), 12.213321241325136) (('masha', 'heddle'), 13.59663237567132) (('goal', 'posts'), 12.172679256827792) (('aron', 'santagar'), 13.485601063282576) (('restricted', 'section'), 12.172679256827792) (('tobho', 'mott'), 13.433133643388441) (('diagon', 'alley'), 12.020676163382742) (('lyn', 'corbray'), 13.42670737422901) (('flavor', 'beans'), 11.85075116194043) (('arthur', 'dayne'), 13.386065389731662) (('smelting', 'stick'), 11.698748068495377) (('andals', 'rhoynar'), 13.333597969837527) (('shooting', 'stars'), 11.587716756106634) (('gaml', 'thronls'), 13.234062296286613) (('lee', 'jordan'), 11.376819973608017) (('balon', 'swann'), 13.111205548501081) (('bloody', 'baron'), 11.265788661219275) (('donal', 'noye'), 13.11120554850108) (('marcus', 'flint'), 11.213321241325136) (('dosh', 'khaleen'), 13.11120554850108) (('leaky', 'cauldron'), 10.85075116194043) (('r.r', 'martin'), 13.044091352642543) (('privet', 'drive'), 10.69874806849538) (('willis', 'wode'), 13.011669874950165) (('marble', 'staircase'), 10.642164540129013) (('mummer', 'farce'), 12.918560470558685) (('chocolate', 'frogs'), 10.6056386641039) (('karyl', 'vance'), 12.900638562561422) (('nimbus', 'thousand'), 10.580103571996759) (('huny', 'huny'), 12.859666781505117) (('seamus', 'finnigan'), 10.476355647158933) (('george', 'r.r'), 12.848171142667287) (('witches', 'wizards'), 10.357711150660315) (('hallis', 'mollen'), 12.831097629308347) (('fat', 'lady'), 10.30643064571662) (('galbart', 'glover'), 12.72216325775518) (('platform', 'three-quarters'),10.283710569216538) (('jason', 'mallister'), 12.703547579587832) (('crabbe', 'goyle'), 10.213321241325136) (('two-handed', 'greatsword'), 12.6290538533637) (('eleven', "o'clock"), 10.020676163382744) (('roose', 'bolton'), 12.588170796923126) (('three-headed', 'dog'), 10.00275425538548) (('bowen', 'marsh'), 12.526243047779925) (('hundred', 'thirteen'), 9.940302746918723) (('thoros', 'myr'), 12.468527549923635) (('nicolas', 'flamel'), 9.913760959466233) (('flea', 'bottom'), 12.459128851921387) (('madam', 'pomfrey'), 9.850751161940432) (('moat', 'cailin'), 12.394998514501673) (('madam', 'malkin'), 9.85075116194043) (('janos', 'slynt'), 12.356318046337611) (('madam', 'hooch'), 9.850751161940428) (('marq', 'piper'), 12.301176492145153) (('car', 'crash'), 9.628358740603982) (('mole', 'town'), 12.289203850479076) (('miss', 'granger'), 9.483735177524528) (('lemon', 'cakes'), 12.218120752417592) (('ministry', 'magic'), 9.435713662661584) (('crones', 'dosh'), 12.21812075241759) (('vault', 'hundred'), 9.425729574088965) (('beric', 'dondarrion'), 12.202353436559275) (('portrait', 'fat'), 9.405966319267536) (('pledge', 'fealty'), 12.163672968395215) (('mirror', 'erised'), 9.274721785989282) (('visenya', 'hill'), 12.163672968395215) (('white', 'pieces'), 9.218482946440917) (('raymun', 'darry'), 12.111205548501081) (('invisibility', 'cloak'), 9.187786149217997) (('aegon', 'conqueror'), 12.066117658972543) (('fifty', 'points'), 9.182732921491715) (('meryn', 'trant'), 12.06057947543111) (('fred', 'george'), 9.113785567774222) (('vaes', 'dothrak'), 11.918560470558687) (('half', 'hour'), 9.066479852995863) (('jaremy', 'rykker'), 11.89619265753023) (('school', 'witchcraft'), 8.933213322132401) (('ilyn', 'payne'), 11.87416635120023) (('fast', 'asleep'), 8.891393146437776) (('cuts', 'deeper'), 11.822636050560149) (('aunt', 'petunia'), 8.86585805433064) (('crowned', 'stag'), 11.748635469116373) (('dark', 'arts'), 8.722995614742059) (('fermented', 'mare'), 11.6706329571151) (('leaned', 'forward'), 8.670178916298608) (('shagga', 'dolf'), 11.6706329571151) (('unicorn', 'blood'), 8.359610683575793) (('vayon', 'poole'), 11.6706329571151) (('sorcerer', 'stone'), 8.329872292096393) (('begging', 'pardons'), 11.65552606472489) (('common', 'room'), 8.327189205883416) (('maegor', 'holdfast'), 11.651773929863785) (('trophy', 'room'), 8.265788661219272) (('vardis', 'egen'), 11.333597969837529) (('h.', 'potter'), 8.085216415577452) (('samwell', 'tarly'), 11.330595481676006)