For example I have two files, sentences.txt and labels.txt
sentences.txt:
This is a sentence
This is not a sentence
Hello world
Hello world too
labels.txt:
1
1
0
0
Each number in labels.txt is associated with the sentence in sentences.txt in the same position. I would like to randomly select 50% for testing and 50% for training, and it seems that I cannot simply random.shuffle(data) like in this question. So how could I split the dataset randomly? Thanks.