import glob
import os


dataPath = os.path.dirname(__file__) + '/data/cz2/max-5000'
classes = ['neg', 'pos']


def create_chunklist(dataset):
    lists = []
    min_len = None
    for c in classes:
        files = glob.glob(dataPath + '/' + dataset + '-' + c + '*.pkl')
        min_len = len(files) if min_len is None else min(min_len, len(files))
        lists.append(files)

    chunklist = []
    for i in range(0, min_len):
        chunkrow = []
        for l in lists:
            chunkrow.append(l[i])
        chunklist.append(chunkrow)

    return chunklist


if __name__ == "__main__":
    chunklist = create_chunklist('train')
    print chunklist
