add solution

This commit is contained in:
Maciej Ścigacz 2022-04-22 11:28:12 +02:00
parent d9a613fb10
commit 431761f6f5
4 changed files with 428577 additions and 0 deletions

137314
dev-0/out.tsv Normal file

File diff suppressed because it is too large Load Diff

156606
dev-1/out.tsv Normal file

File diff suppressed because it is too large Load Diff

39
run.py
View File

@ -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

File diff suppressed because it is too large Load Diff