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
| function updateData(){ | |
| d3.json('https://storyplotsapp.herokuapp.com/api', { | |
| method:"POST", | |
| body: JSON.stringify({ | |
| movie_title: ItemSelect | |
| }), | |
| headers: {"Content-type": "application/json; charset=UTF-8"} | |
| }).then(function(data){ | |
| console.log(data); | |
| // // Prepare and clean data |
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
| from scipy.cluster.hierarchy import fcluster | |
| import scipy.cluster.hierarchy as hac | |
| Z = hac.linkage(df_interpolate.iloc[:,0:266], method='ward', metric='euclidean') | |
| # k Number of clusters I'd like to extract | |
| results = fcluster(Z, k, criterion='maxclust') |
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
| def process(): | |
| windowSizes = [2000] | |
| words = [x.lower() for x in re.findall(r"[\w\@\#\'\&\]\*\-\/\[\=\;]+",raw_text_clean,flags=re.UNICODE)] | |
| lines = raw_text_clean.split("\n") | |
| kwords = [] | |
| klines = [] | |
| for i in range(len(lines)): | |
| if lines[i][0:3] != "<b>": | |
| tmpwords = [x.lower() for x in re.findall(r"[\w\@\#\'\&\]\*\-\/\[\=\;]+",lines[i],flags=re.UNICODE)] | |
| kwords.extend(tmpwords) |
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
| dict = pd.read_csv('./NRC-VAD-Lexicon-Aug2018Release/NRC-VAD-Lexicon-Aug2018Release/NRC-VAD-Lexicon.txt', sep='\t') | |
| dict['Ranking'] = np.arange(1, len(dict)+1) | |
| columnsTitles = ["Word","Ranking","Arousal","Valence","Dominance"] | |
| dict = dict.reindex(columns=columnsTitles) | |
| dict['Arousal'] = dict['Arousal'].astype(str) | |
| newDict = dict.set_index('Word').T.to_dict('list') |
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
| import os | |
| from urllib.parse import quote | |
| from bs4 import BeautifulSoup | |
| import requests | |
| BASE_URL = 'http://www.imsdb.com' | |
| SCRIPTS_DIR = 'scripts' |