2020-03-28 20:40:28 +01:00
|
|
|
from collections import defaultdict
|
|
|
|
import math
|
|
|
|
import pickle
|
|
|
|
|
|
|
|
open_file=open('naive_base_model.pkl','rb')
|
2020-03-29 00:37:57 +01:00
|
|
|
write_file_test=open('test-A/out.tsv','w')
|
|
|
|
write_file_dev=open('dev-0/out.tsv','w')
|
2020-03-28 20:40:28 +01:00
|
|
|
pickle_loaded=pickle.load(open_file)
|
|
|
|
paranomal_class_logprob, skeptic_class_logprob, word_logprobs = pickle_loaded
|
2020-03-29 00:58:08 +01:00
|
|
|
#Niektórych słów nie bezie w zbiorze treningowym dev-0 i dev-A
|
2020-03-29 00:37:57 +01:00
|
|
|
for i in word_logprobs.keys():
|
2020-03-31 01:10:38 +02:00
|
|
|
try:
|
|
|
|
for token, tokens in word_logprobs[i].items():
|
|
|
|
if (word_logprobs['skeptic'][token] > word_logprobs['paranormal'][token]):
|
|
|
|
write_file_test.write("S\n")
|
|
|
|
write_file_dev.write("S\n")
|
|
|
|
else:
|
|
|
|
write_file_test.write("P\n")
|
|
|
|
write_file_dev.write("P\n")
|
|
|
|
except KeyError:
|
|
|
|
print(token + " not avaible")
|