Assignment 7 - Repetition in Lyrics

Example Output

Learning Outcomes

  1. Arrays
  2. String Manipluation
  3. Conditions
  4. Loops

Goals

The purpose of this assignment is to learn to

  1. Access lyrics data through BRIDGES.
  2. Manipulate a ColorGrid object.
  3. Show repetition patterns in songs.

You will generate a visualization that looks like in the figure above.

Description

Task

In this assignment, the objective is to pull a song from Bridges, split the lyrics into individual words, and compare each word against every other word to check for repetition.

From these lyrics, you will be building a matrix, or a ColorGrid in this case, where every row and every column represents a sequential word in the song's lyrics.

Upon finding repetition, you will be setting the pixel at that location to a color of your choice at that point in the grid.

Basic

  1. Open your scaffolded code.
  2. Plug in your credentials.
  3. Complete the TODO's.
  4. Run and visualize the code.

Build a ColorGrid

  1. Plug in your credentials.
  2. Think of any song which contains words.
  3. Query Bridges for said Song. For example
 Song mySong = Bridges.getSong("My Favorite Song", "Optional Artist String");	
 String lyrics = mySong.getLyrics();
 Song mySong = DataSource::getSong("My Favorite Song", "Optional Artist String");	
 auto lyrics = mySong.getLyrics();
so = get_song("My Favorite Song", "Optional Artist String")
song = so.get_lyrics()
  1. Pass these lyrics through the provided helper function, which will clean up and split the lyrics into an array of squeaky clean Strings.

  2. Initialize a ColorGrid with the dimensions the size of the array returned from the helper function.

  3. Iterate over the split lyrics array, checking to see if there is any repetition. For example, if word 1 is the same as the word 6, you would color the pixel at (1, 6), and later on at (6, 1).

  4. After filling out your grid, set it as the data structure on your Bridges object, and run the code.

Extensions

Help

For Java

ColorGrid documentation

Color documentation

DataSource documentation

Song documentation

Bridges class documentation

For C++

ColorGrid documentation

Color documentation

Song documentation

DataSource documentation

For Python

Bridges documentation

Color documentation

ColorGrid documentation

Song documentation