robbiebarrat / rapping-neural-network

Rap song writing recurrent neural network trained on Kanye West's entire discography

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String index out of range?

singthefish opened this issue · comments

Hello! This may be a silly question, as I am indeed a fresh newbie. Sorry for the inconvenience!

I've been trying to train a new set of lyrics, but I get the error described below. I figured I must have done something wrong with my lyrics file, despite having checked for weird punctuation and symbols and anything else that stood out. But I can't find out what it is - I even tried adding lyrics to the original Kanye lyrics file and it will take some new lyrics and train fine but eventually I'll add one that makes it break. What could I possibly be doing wrong?

Traceback (most recent call last):
File "model.py", line 300, in
main(depth, train_mode)
File "model.py", line 289, in main
x_data, y_data = build_dataset(bars, rhyme_list)
File "model.py", line 144, in build_dataset
line_list = [line, syllables(line), rhyme(line, rhyme_list)]
File "model.py", line 43, in syllables
if word[0] in vowels:
IndexError: string index out of range

Congratulations on your work, thank you for your attention and again - sorry if this is too pedestrian! I'm still learning. :)

I have the same problem when I try to use some lyrics in another language. Is it happening the same to you?

Are there double spaces in your lyrics file? It looks like when trying to get the first letter of the word in question; it runs into an error. A potential answer would be if there were instances of two spaces in a row, and the program tries to get a nonexistent word in between the two consecutive spaces...

@robbiebarrat It works! The problem was a "-" that I didn't see. Thank you very much and compliments for the project!

@albertocattani no problem - i really need to rewrite it so that it doesnt crash on stuff like this...