October 2018
Intermediate to advanced
472 pages
10h 57m
English
To build a model that can generate lyrics, we will need a huge amount of lyric data, which can easily be extracted from various sources. We collected lyrics from around 10,000 songs and stored them in a text file called lyrics_data.txt. You can find the data file in our GitHub repository (https://github.com/PacktPublishing/Python-Deep-Learning-Projects/blob/master/Chapter06/Lyrics-ai/lyrics_data.txt).
Now that we have our data, we need to convert this raw text into the one-hot encoding version:
import numpy as npimport codecs# Class to perform all preprocessing operationsclass Preprocessing: vocabulary = {} binary_vocabulary = {} char_lookup = {} size = 0 separator = '->'# This will take the data file and convert data ...Read now
Unlock full access