import random

if __name__ == '__main__':
    random.seed(426516)
    test = 0.1
    val = 0.05

    with open('neg.txt', 'r') as file:
        lines_neg = file.readlines()
    random.shuffle(lines_neg)

    with open('pos.txt', 'r') as file:
        lines_pos = file.readlines()
    random.shuffle(lines_pos)

    with open('sentiment.dev.0', 'w') as file:
        file.writelines(lines_neg[:int(val * len(lines_neg))])

    with open('sentiment.test.0', 'w') as file:
        file.writelines(lines_neg[int(val * len(lines_neg)):  int(val * len(lines_neg)) + int(test * len(lines_neg))])

    with open('sentiment.train.0', 'w') as file:
        file.writelines(lines_neg[int(val * len(lines_neg)) + int(test * len(lines_neg)):])

    with open('sentiment.dev.1', 'w') as file:
        file.writelines(lines_pos[:int(val * len(lines_neg))])

    with open('sentiment.test.1', 'w') as file:
        file.writelines(lines_pos[int(val * len(lines_neg)):  int(val * len(lines_neg)) + int(test * len(lines_neg))])

    with open('sentiment.train.1', 'w') as file:
        file.writelines(lines_pos[int(val * len(lines_neg)) + int(test * len(lines_neg)):])
