Compare commits

..

1 Commits

Author SHA1 Message Date
c4eef02f76 added files 2021-05-07 18:39:13 +02:00
6 changed files with 310453 additions and 0 deletions

5272
dev-0/in.tsv Normal file

File diff suppressed because one or more lines are too long

5272
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

26
main.py Normal file
View File

@ -0,0 +1,26 @@
from sklearn.naive_bayes import MultinomialNB
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
def getData(path):
with open(path) as source:
return source.readlines()
trainInData = getData('./train/in.tsv')
trainExpData = getData('./train/expected.tsv')
afterTransform = LabelEncoder().fit_transform(trainExpData)
pipeline = Pipeline(steps=[('tfidf', TfidfVectorizer()),('naive-bayes', MultinomialNB())])
model = pipeline.fit(trainInData, afterTransform)
def getResult(path):
dataToPredict = getData(path + 'in.tsv')
pred = model.predict(dataToPredict)
with open(path + "out.tsv", "w") as result:
for prediction in pred:
result.write(str(prediction) + '\n')
getResult('./dev-0/')
getResult('./test-A/')

5152
test-A/in.tsv Normal file

File diff suppressed because one or more lines are too long

5152
test-A/out.tsv Normal file

File diff suppressed because it is too large Load Diff

289579
train/in.tsv Normal file

File diff suppressed because one or more lines are too long