Example #1
0
def dislike():
  s = readTwitterHandle()
  global level
  level += 1
  tweets = parsing_emotions.get_five_tweets(s)
  (e_counts, s_counts) = parsing_emotions.getCounts(tweets)
  e_max = parsing_emotions.getMaxCount(e_counts)
  global song_set
  song_set = music.createPlaylist(e_max, level)
  displayData(song_set)
Example #2
0
def like():
  s = readTwitterHandle()
  global level
  global song_set
  tweets = parsing_emotions.get_five_tweets(s)
  (e_counts, s_counts) = parsing_emotions.getCounts(tweets)
  e_max = parsing_emotions.getMaxCount(e_counts)
  if level > 1:
    level -= 1
  new_song_set = music.createSimilarPlaylist(e_max, song_set, level)
  song_set = new_song_set
  displayData(song_set)
Example #3
0
def getMood(lyrics, mood_index, level):
  assert level >= 1
  if level > 5:
    level = 5

  it = iter(lyrics.splitlines())
  lines = []
  for i in range(level):
    lines.append(it.next())
  
  (e_counts, s_counts) = parsing_emotions.getCounts(lines)

  #find max count in e_counts -> this represents the predominant emotion
  e_max = max(e_counts)
  if e_max == mood_index:
    return True

  return False
Example #4
0
    seed = getSeedArtist()
    singer = getSimilarArtist(seed)
    song = getSongForMood(mood, singer, level)
    song_set.append(song)
    i -= 1

  return song_set

if __name__ == "__main__":
  parsing_emotions.buildSets()
  #print list(angerSet)

  tweets = parsing_emotions.get_five_tweets("itsmeaditi_")
  #print(tweettexts)

  (e_counts, s_counts) = parsing_emotions.getCounts(tweets)

  e_max = parsing_emotions.getMaxCount(e_counts)

  song_set = createPlaylist(e_max, 1)
  print song_set

  #print list(counts)
  #print list(sent_counts)


# getMood(getLyrics(a.name,result.title), "happy", 4)