diff --git a/rockyRoadtoDublin.py b/rockyRoadtoDublin.py index 428e0a4..b252ac6 100644 --- a/rockyRoadtoDublin.py +++ b/rockyRoadtoDublin.py @@ -1,8 +1,12 @@ import inout as io def generateChooChoo(data, target, categories): - data = [x[2].replace('\n', '').replace(':', '') for x in io.read(data)] + data = io.read(data) + years = [x[0] for x in data] + text = [x[2].replace('\n', '').replace(':', '') for x in data] target = [x[0].replace('\n', '') for x in io.read(target)] + for i in range(len(text)): + data[i] = text[i] + ' year:' if categories == {}: i = 0 @@ -14,7 +18,11 @@ def generateChooChoo(data, target, categories): return {'data': data, 'target': target}, categories def predictFuture(test): - data = [x[2].replace('\n', '').replace(':', '') for x in io.read(test + '/in.tsv')] + data = io.read(test) + years = [x[0] for x in data] + text = [x[2].replace('\n', '').replace(':', '') for x in data] + for i in range(len(text)): + data[i] = text[i] + ' year:' with open('vw-' + test, 'w', encoding='utf-8') as f: for text in data: f.write('1 |text ' + text + '\n')