Francesco commited on
Commit
2a6cb96
1 Parent(s): 6fa0132

minor changes

Browse files
scrape.py CHANGED
@@ -1,6 +1,3 @@
1
- # def get_lyrics_url_from_website():
2
- # # https://www.disneyclips.com/lyrics/
3
-
4
  import asyncio
5
  import json
6
  from collections import defaultdict
@@ -10,6 +7,10 @@ from typing import List, Optional, Tuple, TypedDict
10
  import aiohttp
11
  from bs4 import BeautifulSoup
12
 
 
 
 
 
13
  URL = "https://www.disneyclips.com/lyrics/"
14
 
15
 
 
 
 
 
1
  import asyncio
2
  import json
3
  from collections import defaultdict
 
7
  import aiohttp
8
  from bs4 import BeautifulSoup
9
 
10
+ """
11
+ This file scrapes disney songs + lyrics from "https://www.disneyclips.com/lyrics/"
12
+ """
13
+
14
  URL = "https://www.disneyclips.com/lyrics/"
15
 
16
 
scripts/create_emotions_summary.py CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  from dotenv import load_dotenv
2
 
3
  load_dotenv()
 
1
+ """
2
+ This script takes all the songs we have and use the lyric to create a list of 8 emotions we then use to replace the lyric itself.
3
+ This is needed to properly match user's emotions to the songs.
4
+ """
5
+
6
  from dotenv import load_dotenv
7
 
8
  load_dotenv()
scripts/create_one_sentence_summary.py CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  from dotenv import load_dotenv
2
 
3
  load_dotenv()
@@ -21,7 +25,7 @@ llm = ChatOpenAI(temperature=0)
21
  chain = LLMChain(llm=llm, prompt=prompt)
22
 
23
  with open(
24
- "/home/zuppif/Documents/Work/ActiveLoop/ai-shazam/data/lyrics_with_spotify_url.json",
25
  "r",
26
  ) as f:
27
  data = json.load(f)
@@ -38,7 +42,7 @@ for movie, lyrics in data.items():
38
  }
39
 
40
  with open(
41
- "/home/zuppif/Documents/Work/ActiveLoop/ai-shazam/data/lyrics_with_spotify_url_and_summary.json",
42
  "w",
43
  ) as f:
44
  json.dump(lyrics_summaries, f)
 
1
+ """
2
+ This script takes all the songs we have and create a summary for each lyric
3
+ """
4
+
5
  from dotenv import load_dotenv
6
 
7
  load_dotenv()
 
25
  chain = LLMChain(llm=llm, prompt=prompt)
26
 
27
  with open(
28
+ "data/lyrics_with_spotify_url.json",
29
  "r",
30
  ) as f:
31
  data = json.load(f)
 
42
  }
43
 
44
  with open(
45
+ "data/lyrics_with_spotify_url_and_summary.json",
46
  "w",
47
  ) as f:
48
  json.dump(lyrics_summaries, f)
scripts/keep_only_lyrics_on_spotify.py CHANGED
@@ -1,9 +1,11 @@
1
- """This script will keep only the lyrics that are in the Spotify "Disney Hits" playlist
 
2
  """
3
  from dotenv import load_dotenv
4
 
5
  load_dotenv()
6
  import json
 
7
 
8
  import spotipy
9
  from spotipy.oauth2 import SpotifyClientCredentials
@@ -17,10 +19,6 @@ items = results["playlists"]["items"]
17
  uri = "spotify:playlist:37i9dQZF1DX8C9xQcOrE6T"
18
  playlist = spotify.playlist(uri)
19
 
20
- # with open("spotify_disney_songs.json", "w") as f:
21
- # json.dump(playlist,f)
22
-
23
-
24
  with open("data/lyrics.json", "r") as f:
25
  data = json.load(f)
26
 
@@ -36,7 +34,6 @@ for item in playlist["tracks"]["items"]:
36
  }
37
 
38
  # here we add only songs that are in the Disney spotify playlist
39
- from collections import defaultdict
40
 
41
  data_filtered = defaultdict(list)
42
  tot = 0
 
1
+ """
2
+ This script will keep only the songs that are in the Spotify "Disney Hits" playlist
3
  """
4
  from dotenv import load_dotenv
5
 
6
  load_dotenv()
7
  import json
8
+ from collections import defaultdict
9
 
10
  import spotipy
11
  from spotipy.oauth2 import SpotifyClientCredentials
 
19
  uri = "spotify:playlist:37i9dQZF1DX8C9xQcOrE6T"
20
  playlist = spotify.playlist(uri)
21
 
 
 
 
 
22
  with open("data/lyrics.json", "r") as f:
23
  data = json.load(f)
24
 
 
34
  }
35
 
36
  # here we add only songs that are in the Disney spotify playlist
 
37
 
38
  data_filtered = defaultdict(list)
39
  tot = 0