This commit is contained in:
Maciej Czajka 2022-04-20 13:02:41 +02:00
parent 4cc9c3dcf5
commit f97a19712e
4 changed files with 211046 additions and 211051 deletions

134238
dev-0/out.tsv

File diff suppressed because it is too large Load Diff

154956
dev-1/out.tsv

File diff suppressed because it is too large Load Diff

15
run.py
View File

@ -4,7 +4,7 @@ man = ['silnik', 'windows', 'silnika', 'gb', 'mb', 'meczu', 'pc', 'opony', 'appl
'ubuntu', 'systemu', 'serwer'] 'ubuntu', 'systemu', 'serwer']
woman = ['ciąży', 'miesiączki', 'ciasto', 'ciążę', 'zadowolona', 'ciąża', 'ciazy', 'antykoncepcyjne', 'ginekologa', woman = ['ciąży', 'miesiączki', 'ciasto', 'ciążę', 'zadowolona', 'ciąża', 'ciazy', 'antykoncepcyjne', 'ginekologa',
'tabletki', 'porodzie', 'mąż', 'miesiączkę', 'krwawienie', 'ciasta'] 'tabletki', 'porodzie', 'mąż', 'miesiączkę', 'krwawienie', 'ciasta']
#
# stemowanie # stemowanie
def steming(man, woman): def steming(man, woman):
man_stem = [] man_stem = []
@ -28,12 +28,12 @@ def predict(man_stem, woman_stem, dane):
man_count += 1 man_count += 1
elif w[:5].lower() in woman_stem: elif w[:5].lower() in woman_stem:
woman_count += 1 woman_count += 1
if man_count > woman_count: if man_count >= woman_count:
res.append('1') res.append('1')
elif man_count < woman_count: elif man_count < woman_count:
res.append('0') res.append('0')
else: # else:
res.append(str(round(random.random()))) # res.append(str(round(random.random())))
return res return res
@ -43,12 +43,7 @@ def out_file(res, name):
file.write(p + "\n") file.write(p + "\n")
man_dict, woman_dict = steming(man, woman) man_dict, woman_dict = steming(man, woman)
dane = [] dane = []
with open('dev-0/in.tsv') as data: with open('dev-0/in.tsv') as data:
for idx, line in enumerate(data.readlines()): for idx, line in enumerate(data.readlines()):
@ -71,4 +66,4 @@ with open('test-A/in.tsv') as data:
dane3.append(line.replace('\n', '')) dane3.append(line.replace('\n', ''))
result = predict(man_dict, woman_dict, dane3) result = predict(man_dict, woman_dict, dane3)
out_file(result, 'test-A/out.tsv') out_file(result, 'test-A/out.tsv')

File diff suppressed because it is too large Load Diff