robbiebarrat / rapping-neural-network

Rap song writing recurrent neural network trained on Kanye West's entire discography
1.04k stars 167 forks source link

String index out of range? #21

Closed singthefish closed 6 years ago

singthefish commented 6 years ago

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. :)

albertocattani commented 6 years ago

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

robbiebarrat commented 6 years ago

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...

albertocattani commented 6 years ago

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

robbiebarrat commented 6 years ago

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