Skip to content
Snippets Groups Projects
splitSimple.py 497 B
Newer Older
#!/usr/bin/env python3
from GEODE.util import initialise, parseRatio
import JSONL
from prodigyAcceptedJSONLToTSV import acceptedToTSV
from sys import argv, stdin

def splitSimple(jsonl, trainRatio, trainOutput, testOutput):
    size = round(len(jsonl) * trainRatio)
    train = jsonl[:size]
    test = jsonl[size:]
    acceptedToTSV(train, trainOutput)
    acceptedToTSV(test, testOutput)

if __name__ == '__main__':
    splitSimple(list(JSONL.load(stdin)), parseRatio(argv[1]), argv[2], argv[3])