18 lines
706 B
Python
18 lines
706 B
Python
from collections import defaultdict
|
|
import math
|
|
import pickle
|
|
|
|
open_file=open('naive_base_model.pkl','rb')
|
|
write_file_test=open('test-A/out.tsv','w')
|
|
write_file_dev=open('dev-0/out.tsv','w')
|
|
pickle_loaded=pickle.load(open_file)
|
|
paranomal_class_logprob, skeptic_class_logprob, word_logprobs = pickle_loaded
|
|
#Niektórych słów nie bezie w zbiorze treningowym dev-0 i dev-A
|
|
for i in word_logprobs.keys():
|
|
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") |