add solution
This commit is contained in:
parent
d9a613fb10
commit
431761f6f5
137314
dev-0/out.tsv
Normal file
137314
dev-0/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
156606
dev-1/out.tsv
Normal file
156606
dev-1/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
39
run.py
39
run.py
@ -0,0 +1,39 @@
|
||||
import random
|
||||
|
||||
man_words_list = ['silnik', 'windows', 'silnika', 'gb', 'mb', 'meczu', 'pc', 'opony', 'apple', 'iphone', 'zwiastuny', 'hd',
|
||||
'ubuntu', 'systemu', 'serwer']
|
||||
|
||||
woman_words_list = ['ciąży', 'miesiączki', 'ciasto', 'ciążę', 'zadowolona', 'ciąża', 'ciazy', 'antykoncepcyjne', 'ginekologa',
|
||||
'tabletki', 'porodzie', 'mąż', 'miesiączkę', 'krwawienie', 'ciasta']
|
||||
|
||||
def classificator(path_in, path_out):
|
||||
result = []
|
||||
with open (path_in, "r", encoding="UTF-8") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
counter_man = 0
|
||||
counter_woman = 0
|
||||
for word in man_words_list:
|
||||
if word in line:
|
||||
counter_man += 1
|
||||
|
||||
for word in woman_words_list:
|
||||
if word in line:
|
||||
counter_woman += 1
|
||||
|
||||
maximum = max(counter_man, counter_woman)
|
||||
|
||||
if maximum == 0 or counter_man == counter_woman:
|
||||
rand = random.randint(0, 1)
|
||||
result.append(f"{rand}\n")
|
||||
elif maximum == counter_man:
|
||||
result.append("1\n")
|
||||
elif maximum == counter_woman:
|
||||
result.append("0\n")
|
||||
|
||||
with open (path_out, "w", encoding="UTF-8") as output:
|
||||
output.writelines(result)
|
||||
|
||||
classificator("dev-0\in.tsv", "dev-0\out.tsv")
|
||||
classificator("dev-1\in.tsv", "dev-1\out.tsv")
|
||||
classificator("test-A\in.tsv", "test-A\out.tsv")
|
134618
test-A/out.tsv
Normal file
134618
test-A/out.tsv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user