Update rockyRoadtoDublin.py
This commit is contained in:
parent
40653583a6
commit
57bb940cb8
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user